@streamflow/stream 9.0.3 → 10.0.0-alpha.p313.3ce4d29
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 +6 -62
- package/dist/cjs/index.cjs +421 -3786
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +3 -186
- package/dist/cjs/solana/index.cjs +376 -301
- 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 -186
- package/dist/esm/index.js +239 -3617
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1134 -17
- package/dist/esm/solana/index.js +257 -232
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -43
- package/dist/cjs/BaseStreamClient-DOyJqO7R.d.cts +0 -551
- package/dist/cjs/aptos/index.cjs +0 -456
- 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 -1915
- package/dist/cjs/evm/index.cjs.map +0 -1
- package/dist/cjs/evm/index.d.cts +0 -13
- package/dist/cjs/index-BMZATAYa.d.cts +0 -213
- package/dist/cjs/index-BgGtpOPg.d.cts +0 -850
- package/dist/cjs/index-DYIamO0j.d.cts +0 -203
- package/dist/cjs/index-Y0HH2ugY.d.cts +0 -136
- package/dist/cjs/sui/index.cjs +0 -1021
- package/dist/cjs/sui/index.cjs.map +0 -1
- package/dist/cjs/sui/index.d.cts +0 -13
- package/dist/esm/BaseStreamClient-DOyJqO7R.d.ts +0 -551
- package/dist/esm/aptos/index.d.ts +0 -14
- package/dist/esm/aptos/index.js +0 -443
- 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 -1902
- package/dist/esm/evm/index.js.map +0 -1
- package/dist/esm/index-D54wSYym.d.ts +0 -203
- package/dist/esm/index-Dp5DXxr-.d.ts +0 -850
- package/dist/esm/index-DrzqsoIB.d.ts +0 -136
- package/dist/esm/index-elpYUBph.d.ts +0 -213
- package/dist/esm/sui/index.d.ts +0 -13
- package/dist/esm/sui/index.js +0 -1011
- package/dist/esm/sui/index.js.map +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,425 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ICluster, ContractError, IChain, assertHasPublicKey, invariant, getBN as getBN$1 } from '@streamflow/common';
|
|
3
|
-
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
4
|
-
import BN7 from 'bn.js';
|
|
5
|
-
import { Buffer } from 'buffer';
|
|
6
|
-
import '@manahippo/aptos-wallet-adapter';
|
|
7
|
-
import { ethers } from 'ethers';
|
|
8
|
-
import { toChecksumAddress } from 'ethereum-checksum-address';
|
|
1
|
+
import BN3 from 'bn.js';
|
|
9
2
|
import bs58 from 'bs58';
|
|
3
|
+
import { Buffer } from 'buffer';
|
|
10
4
|
import { NATIVE_MINT, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
11
5
|
import { PublicKey, TransactionInstruction, Connection, Keypair, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
|
|
12
|
-
import { isSignerKeypair, isSignerWallet, executeTransaction, buildSendThrottler, prepareWrappedAccount, prepareTransaction, signAndExecuteTransaction, getMintAndProgram, prepareBaseInstructions, ata, createVersionedTransaction, executeMultipleTransactions, getMultipleAccountsInfoBatched, getProgramAccounts, checkOrCreateAtaBatch } from '@streamflow/common
|
|
6
|
+
import { ICluster, getNumberFromBN, isSignerKeypair, isSignerWallet, executeTransaction, ContractError, buildSendThrottler, assertHasPublicKey, prepareWrappedAccount, prepareTransaction, signAndExecuteTransaction, invariant, getMintAndProgram, prepareBaseInstructions, getBN, ata, createVersionedTransaction, executeMultipleTransactions, getMultipleAccountsInfoBatched, getProgramAccounts, checkOrCreateAtaBatch } from '@streamflow/common';
|
|
7
|
+
export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
|
|
13
8
|
import * as borsh from 'borsh';
|
|
14
9
|
import { Program } from '@coral-xyz/anchor';
|
|
15
10
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
16
|
-
import { SuiClient } from '@mysten/sui/client';
|
|
17
|
-
import { Transaction } from '@mysten/sui/transactions';
|
|
18
|
-
import { SUI_CLOCK_OBJECT_ID, SUI_TYPE_ARG } from '@mysten/sui/utils';
|
|
19
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
20
|
-
import { Keypair as Keypair$1 } from '@mysten/sui/cryptography';
|
|
21
|
-
|
|
22
|
-
var __create = Object.create;
|
|
23
|
-
var __defProp = Object.defineProperty;
|
|
24
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
25
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
26
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
27
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
28
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
29
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
30
|
-
};
|
|
31
|
-
var __export = (target, all) => {
|
|
32
|
-
for (var name in all)
|
|
33
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
34
|
-
};
|
|
35
|
-
var __copyProps = (to, from, except, desc) => {
|
|
36
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
37
|
-
for (let key of __getOwnPropNames(from))
|
|
38
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
39
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
40
|
-
}
|
|
41
|
-
return to;
|
|
42
|
-
};
|
|
43
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
44
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
45
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
46
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
47
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
48
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
49
|
-
mod
|
|
50
|
-
));
|
|
51
|
-
|
|
52
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
53
|
-
var require_retry_operation = __commonJS({
|
|
54
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
55
|
-
function RetryOperation(timeouts, options) {
|
|
56
|
-
if (typeof options === "boolean") {
|
|
57
|
-
options = { forever: options };
|
|
58
|
-
}
|
|
59
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
60
|
-
this._timeouts = timeouts;
|
|
61
|
-
this._options = options || {};
|
|
62
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
63
|
-
this._fn = null;
|
|
64
|
-
this._errors = [];
|
|
65
|
-
this._attempts = 1;
|
|
66
|
-
this._operationTimeout = null;
|
|
67
|
-
this._operationTimeoutCb = null;
|
|
68
|
-
this._timeout = null;
|
|
69
|
-
this._operationStart = null;
|
|
70
|
-
this._timer = null;
|
|
71
|
-
if (this._options.forever) {
|
|
72
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
module.exports = RetryOperation;
|
|
76
|
-
RetryOperation.prototype.reset = function() {
|
|
77
|
-
this._attempts = 1;
|
|
78
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
79
|
-
};
|
|
80
|
-
RetryOperation.prototype.stop = function() {
|
|
81
|
-
if (this._timeout) {
|
|
82
|
-
clearTimeout(this._timeout);
|
|
83
|
-
}
|
|
84
|
-
if (this._timer) {
|
|
85
|
-
clearTimeout(this._timer);
|
|
86
|
-
}
|
|
87
|
-
this._timeouts = [];
|
|
88
|
-
this._cachedTimeouts = null;
|
|
89
|
-
};
|
|
90
|
-
RetryOperation.prototype.retry = function(err) {
|
|
91
|
-
if (this._timeout) {
|
|
92
|
-
clearTimeout(this._timeout);
|
|
93
|
-
}
|
|
94
|
-
if (!err) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
98
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
99
|
-
this._errors.push(err);
|
|
100
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
this._errors.push(err);
|
|
104
|
-
var timeout = this._timeouts.shift();
|
|
105
|
-
if (timeout === void 0) {
|
|
106
|
-
if (this._cachedTimeouts) {
|
|
107
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
108
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
109
|
-
} else {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
var self = this;
|
|
114
|
-
this._timer = setTimeout(function() {
|
|
115
|
-
self._attempts++;
|
|
116
|
-
if (self._operationTimeoutCb) {
|
|
117
|
-
self._timeout = setTimeout(function() {
|
|
118
|
-
self._operationTimeoutCb(self._attempts);
|
|
119
|
-
}, self._operationTimeout);
|
|
120
|
-
if (self._options.unref) {
|
|
121
|
-
self._timeout.unref();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
self._fn(self._attempts);
|
|
125
|
-
}, timeout);
|
|
126
|
-
if (this._options.unref) {
|
|
127
|
-
this._timer.unref();
|
|
128
|
-
}
|
|
129
|
-
return true;
|
|
130
|
-
};
|
|
131
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
132
|
-
this._fn = fn;
|
|
133
|
-
if (timeoutOps) {
|
|
134
|
-
if (timeoutOps.timeout) {
|
|
135
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
136
|
-
}
|
|
137
|
-
if (timeoutOps.cb) {
|
|
138
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
var self = this;
|
|
142
|
-
if (this._operationTimeoutCb) {
|
|
143
|
-
this._timeout = setTimeout(function() {
|
|
144
|
-
self._operationTimeoutCb();
|
|
145
|
-
}, self._operationTimeout);
|
|
146
|
-
}
|
|
147
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
148
|
-
this._fn(this._attempts);
|
|
149
|
-
};
|
|
150
|
-
RetryOperation.prototype.try = function(fn) {
|
|
151
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
152
|
-
this.attempt(fn);
|
|
153
|
-
};
|
|
154
|
-
RetryOperation.prototype.start = function(fn) {
|
|
155
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
156
|
-
this.attempt(fn);
|
|
157
|
-
};
|
|
158
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
159
|
-
RetryOperation.prototype.errors = function() {
|
|
160
|
-
return this._errors;
|
|
161
|
-
};
|
|
162
|
-
RetryOperation.prototype.attempts = function() {
|
|
163
|
-
return this._attempts;
|
|
164
|
-
};
|
|
165
|
-
RetryOperation.prototype.mainError = function() {
|
|
166
|
-
if (this._errors.length === 0) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
var counts = {};
|
|
170
|
-
var mainError = null;
|
|
171
|
-
var mainErrorCount = 0;
|
|
172
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
173
|
-
var error = this._errors[i];
|
|
174
|
-
var message = error.message;
|
|
175
|
-
var count = (counts[message] || 0) + 1;
|
|
176
|
-
counts[message] = count;
|
|
177
|
-
if (count >= mainErrorCount) {
|
|
178
|
-
mainError = error;
|
|
179
|
-
mainErrorCount = count;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return mainError;
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
188
|
-
var require_retry = __commonJS({
|
|
189
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
|
|
190
|
-
var RetryOperation = require_retry_operation();
|
|
191
|
-
exports.operation = function(options) {
|
|
192
|
-
var timeouts = exports.timeouts(options);
|
|
193
|
-
return new RetryOperation(timeouts, {
|
|
194
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
195
|
-
unref: options && options.unref,
|
|
196
|
-
maxRetryTime: options && options.maxRetryTime
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
exports.timeouts = function(options) {
|
|
200
|
-
if (options instanceof Array) {
|
|
201
|
-
return [].concat(options);
|
|
202
|
-
}
|
|
203
|
-
var opts = {
|
|
204
|
-
retries: 10,
|
|
205
|
-
factor: 2,
|
|
206
|
-
minTimeout: 1 * 1e3,
|
|
207
|
-
maxTimeout: Infinity,
|
|
208
|
-
randomize: false
|
|
209
|
-
};
|
|
210
|
-
for (var key in options) {
|
|
211
|
-
opts[key] = options[key];
|
|
212
|
-
}
|
|
213
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
214
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
215
|
-
}
|
|
216
|
-
var timeouts = [];
|
|
217
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
218
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
219
|
-
}
|
|
220
|
-
if (options && options.forever && !timeouts.length) {
|
|
221
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
222
|
-
}
|
|
223
|
-
timeouts.sort(function(a, b) {
|
|
224
|
-
return a - b;
|
|
225
|
-
});
|
|
226
|
-
return timeouts;
|
|
227
|
-
};
|
|
228
|
-
exports.createTimeout = function(attempt, opts) {
|
|
229
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
230
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
231
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
232
|
-
return timeout;
|
|
233
|
-
};
|
|
234
|
-
exports.wrap = function(obj, options, methods) {
|
|
235
|
-
if (options instanceof Array) {
|
|
236
|
-
methods = options;
|
|
237
|
-
options = null;
|
|
238
|
-
}
|
|
239
|
-
if (!methods) {
|
|
240
|
-
methods = [];
|
|
241
|
-
for (var key in obj) {
|
|
242
|
-
if (typeof obj[key] === "function") {
|
|
243
|
-
methods.push(key);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
for (var i = 0; i < methods.length; i++) {
|
|
248
|
-
var method = methods[i];
|
|
249
|
-
var original = obj[method];
|
|
250
|
-
obj[method] = function retryWrapper(original2) {
|
|
251
|
-
var op = exports.operation(options);
|
|
252
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
253
|
-
var callback = args.pop();
|
|
254
|
-
args.push(function(err) {
|
|
255
|
-
if (op.retry(err)) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
if (err) {
|
|
259
|
-
arguments[0] = op.mainError();
|
|
260
|
-
}
|
|
261
|
-
callback.apply(this, arguments);
|
|
262
|
-
});
|
|
263
|
-
op.attempt(function() {
|
|
264
|
-
original2.apply(obj, args);
|
|
265
|
-
});
|
|
266
|
-
}.bind(obj, original);
|
|
267
|
-
obj[method].options = options;
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
274
|
-
var require_retry2 = __commonJS({
|
|
275
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
|
|
276
|
-
module.exports = require_retry();
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// aptos/index.ts
|
|
281
|
-
var aptos_exports = {};
|
|
282
|
-
__export(aptos_exports, {
|
|
283
|
-
AptosStreamClient: () => AptosStreamClient,
|
|
284
|
-
Contract: () => Contract,
|
|
285
|
-
constants: () => constants_exports,
|
|
286
|
-
default: () => AptosStreamClient,
|
|
287
|
-
extractAptosErrorCode: () => extractAptosErrorCode,
|
|
288
|
-
normalizeAptosAddress: () => normalizeAptosAddress
|
|
289
|
-
});
|
|
290
|
-
var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
|
|
291
|
-
StreamDirection2["Outgoing"] = "outgoing";
|
|
292
|
-
StreamDirection2["Incoming"] = "incoming";
|
|
293
|
-
StreamDirection2["All"] = "all";
|
|
294
|
-
return StreamDirection2;
|
|
295
|
-
})(StreamDirection || {});
|
|
296
|
-
var StreamType = /* @__PURE__ */ ((StreamType2) => {
|
|
297
|
-
StreamType2["All"] = "all";
|
|
298
|
-
StreamType2["Payment"] = "payment";
|
|
299
|
-
StreamType2["Vesting"] = "vesting";
|
|
300
|
-
StreamType2["Lock"] = "lock";
|
|
301
|
-
return StreamType2;
|
|
302
|
-
})(StreamType || {});
|
|
303
|
-
var ContractErrorCode = /* @__PURE__ */ ((ContractErrorCode2) => {
|
|
304
|
-
ContractErrorCode2["ECONTRACT_NOT_INIT"] = "ECONTRACT_NOT_INIT";
|
|
305
|
-
ContractErrorCode2["EBAD_AMOUNT"] = "EBAD_AMOUNT";
|
|
306
|
-
ContractErrorCode2["ENO_PERMISSIONS"] = "ENO_PERMISSIONS";
|
|
307
|
-
ContractErrorCode2["EBADINPUT"] = "EBADINPUT";
|
|
308
|
-
ContractErrorCode2["ECLOSED"] = "ECLOSED";
|
|
309
|
-
ContractErrorCode2["EBAD_INPUT_AMOUNT_PER_PERIOD"] = "EBAD_INPUT_AMOUNT_PER_PERIOD";
|
|
310
|
-
ContractErrorCode2["EBAD_INPUT_PAUSABLE"] = "EBAD_INPUT_PAUSABLE";
|
|
311
|
-
ContractErrorCode2["EBAD_INPUT_UPDATE_RATE"] = "EBAD_INPUT_UPDATE_RATE";
|
|
312
|
-
ContractErrorCode2["EBAD_INPUT_CLIFF_AMOUNT"] = "EBAD_INPUT_CLIFF_AMOUNT";
|
|
313
|
-
ContractErrorCode2["EBAD_INPUT_PERIOD"] = "EBAD_INPUT_PERIOD";
|
|
314
|
-
ContractErrorCode2["EBAD_INPUT_START"] = "EBAD_INPUT_START";
|
|
315
|
-
ContractErrorCode2["EBAD_INSUFFICIENT_TOKEN_ALLOWANCE"] = "EBAD_INSUFFICIENT_TOKEN_ALLOWANCE";
|
|
316
|
-
ContractErrorCode2["EBAD_INSUFFICIENT_WITHDRAWAL_FEES"] = "EBAD_INSUFFICIENT_WITHDRAWAL_FEES";
|
|
317
|
-
ContractErrorCode2["EBAD_INSUFFICIENT_AMOUNT"] = "EBAD_INSUFFICIENT_AMOUNT";
|
|
318
|
-
ContractErrorCode2["EPAUSED"] = "EPAUSED";
|
|
319
|
-
ContractErrorCode2["ENOTPAUSED"] = "ENOTPAUSED";
|
|
320
|
-
ContractErrorCode2["ENO_RECIPIENT_COIN_ADDRESS"] = "ENO_RECIPIENT_COIN_ADDRESS";
|
|
321
|
-
return ContractErrorCode2;
|
|
322
|
-
})(ContractErrorCode || {});
|
|
323
|
-
var SolanaContractErrorCode = /* @__PURE__ */ ((SolanaContractErrorCode2) => {
|
|
324
|
-
SolanaContractErrorCode2["AccountsNotWritable"] = "AccountsNotWritable";
|
|
325
|
-
SolanaContractErrorCode2["InvalidMetadata"] = "InvalidMetadata";
|
|
326
|
-
SolanaContractErrorCode2["InvalidMetadataAccount"] = "InvalidMetadataAccount";
|
|
327
|
-
SolanaContractErrorCode2["MetadataAccountMismatch"] = "MetadataAccountMismatch";
|
|
328
|
-
SolanaContractErrorCode2["InvalidEscrowAccount"] = "InvalidEscrowAccount";
|
|
329
|
-
SolanaContractErrorCode2["NotAssociated"] = "NotAssociated";
|
|
330
|
-
SolanaContractErrorCode2["MintMismatch"] = "MintMismatch";
|
|
331
|
-
SolanaContractErrorCode2["TransferNotAllowed"] = "TransferNotAllowed";
|
|
332
|
-
SolanaContractErrorCode2["ContractClosed"] = "ContractClosed";
|
|
333
|
-
SolanaContractErrorCode2["InvalidTreasury"] = "InvalidTreasury";
|
|
334
|
-
SolanaContractErrorCode2["InvalidTimestamps"] = "InvalidTimestamps";
|
|
335
|
-
SolanaContractErrorCode2["InvalidDepositConfiguration"] = "InvalidDepositConfiguration";
|
|
336
|
-
SolanaContractErrorCode2["AmountIsZero"] = "AmountIsZero";
|
|
337
|
-
SolanaContractErrorCode2["AmountMoreThanAvailable"] = "AmountMoreThanAvailable";
|
|
338
|
-
SolanaContractErrorCode2["AmountAvailableIsZero"] = "AmountAvailableIsZero";
|
|
339
|
-
SolanaContractErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
340
|
-
SolanaContractErrorCode2["InvalidMetadataSize"] = "InvalidMetadataSize";
|
|
341
|
-
SolanaContractErrorCode2["UninitializedMetadata"] = "UninitializedMetadata";
|
|
342
|
-
SolanaContractErrorCode2["Unauthorized"] = "Unauthorized";
|
|
343
|
-
SolanaContractErrorCode2["SelfTransfer"] = "SelfTransfer";
|
|
344
|
-
SolanaContractErrorCode2["AlreadyPaused"] = "AlreadyPaused";
|
|
345
|
-
SolanaContractErrorCode2["NotPaused"] = "NotPaused";
|
|
346
|
-
SolanaContractErrorCode2["MetadataNotRentExempt"] = "MetadataNotRentExempt";
|
|
347
|
-
return SolanaContractErrorCode2;
|
|
348
|
-
})(SolanaContractErrorCode || {});
|
|
349
|
-
var SolanaAlignedProxyErrorCode = /* @__PURE__ */ ((SolanaAlignedProxyErrorCode2) => {
|
|
350
|
-
SolanaAlignedProxyErrorCode2["Unauthorized"] = "Unauthorized";
|
|
351
|
-
SolanaAlignedProxyErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
352
|
-
SolanaAlignedProxyErrorCode2["UnsupportedTokenExtensions"] = "UnsupportedTokenExtensions";
|
|
353
|
-
SolanaAlignedProxyErrorCode2["PeriodTooShort"] = "PeriodTooShort";
|
|
354
|
-
SolanaAlignedProxyErrorCode2["InvalidTickSize"] = "InvalidTickSize";
|
|
355
|
-
SolanaAlignedProxyErrorCode2["InvalidPercentageBoundaries"] = "InvalidPercentageBoundaries";
|
|
356
|
-
SolanaAlignedProxyErrorCode2["InvalidPriceBoundaries"] = "InvalidPriceBoundaries";
|
|
357
|
-
SolanaAlignedProxyErrorCode2["UnsupportedOracle"] = "UnsupportedOracle";
|
|
358
|
-
SolanaAlignedProxyErrorCode2["InvalidOracleAccount"] = "InvalidOracleAccount";
|
|
359
|
-
SolanaAlignedProxyErrorCode2["InvalidOraclePrice"] = "InvalidOraclePrice";
|
|
360
|
-
SolanaAlignedProxyErrorCode2["InvalidStreamMetadata"] = "InvalidStreamMetadata";
|
|
361
|
-
SolanaAlignedProxyErrorCode2["AmountAlreadyUpdated"] = "AmountAlreadyUpdated";
|
|
362
|
-
SolanaAlignedProxyErrorCode2["AllFundsUnlocked"] = "AllFundsUnlocked";
|
|
363
|
-
return SolanaAlignedProxyErrorCode2;
|
|
364
|
-
})(SolanaAlignedProxyErrorCode || {});
|
|
365
|
-
|
|
366
|
-
// common/BaseStreamClient.ts
|
|
367
|
-
var BaseStreamClient = class {
|
|
368
|
-
/**
|
|
369
|
-
* Returns total fee percent, streamflow fees + partner fees
|
|
370
|
-
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
371
|
-
* @param chainSpecificParams additional parameters required by chain client
|
|
372
|
-
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
373
|
-
*/
|
|
374
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
375
|
-
async getTotalFee(getFeesData, chainSpecificParams) {
|
|
376
|
-
const fees = await this.getFees(getFeesData, chainSpecificParams);
|
|
377
|
-
if (fees) {
|
|
378
|
-
return fees.partnerFee + fees.streamflowFee;
|
|
379
|
-
}
|
|
380
|
-
return this.getDefaultStreamflowFee(chainSpecificParams);
|
|
381
|
-
}
|
|
382
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
383
|
-
extractErrorCode(err) {
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
11
|
|
|
388
|
-
//
|
|
389
|
-
var constants_exports = {};
|
|
390
|
-
__export(constants_exports, {
|
|
391
|
-
APTOS_ERROR_MATCH_REGEX: () => APTOS_ERROR_MATCH_REGEX,
|
|
392
|
-
APTOS_MODULE_ERROR_MAP: () => APTOS_MODULE_ERROR_MAP,
|
|
393
|
-
APTOS_PROGRAM_IDS: () => APTOS_PROGRAM_IDS
|
|
394
|
-
});
|
|
395
|
-
var APTOS_PROGRAM_IDS = {
|
|
396
|
-
[ICluster.Mainnet]: "0x9009d93d52576bf9ac6dc6cf10b870610bcb316342fef6eff80662fbbfce51b0",
|
|
397
|
-
// TODO: Add a correct programID for Test net
|
|
398
|
-
[ICluster.Devnet]: "0xc6737de143d91b2f99a7e490d4f8348fdfa3bdd1eb8737a27d0455f8a3625688",
|
|
399
|
-
[ICluster.Testnet]: "0xc6737de143d91b2f99a7e490d4f8348fdfa3bdd1eb8737a27d0455f8a3625688",
|
|
400
|
-
[ICluster.Local]: "0x9009d93d52576bf9ac6dc6cf10b870610bcb316342fef6eff80662fbbfce51b0"
|
|
401
|
-
};
|
|
402
|
-
var APTOS_ERROR_MATCH_REGEX = /Move abort in [a-z0-9]+::([^:]+): ([A-Z_]+)/;
|
|
403
|
-
var APTOS_MODULE_ERROR_MAP = {
|
|
404
|
-
protocol: {
|
|
405
|
-
1: "ECONTRACT_NOT_INIT" /* ECONTRACT_NOT_INIT */,
|
|
406
|
-
2: "EBAD_AMOUNT" /* EBAD_AMOUNT */,
|
|
407
|
-
3: "ENO_PERMISSIONS" /* ENO_PERMISSIONS */,
|
|
408
|
-
4: "EBADINPUT" /* EBADINPUT */,
|
|
409
|
-
5: "ECLOSED" /* ECLOSED */,
|
|
410
|
-
6: "EBAD_INPUT_AMOUNT_PER_PERIOD" /* EBAD_INPUT_AMOUNT_PER_PERIOD */,
|
|
411
|
-
8: "EBAD_INPUT_UPDATE_RATE" /* EBAD_INPUT_UPDATE_RATE */,
|
|
412
|
-
9: "EBAD_INPUT_CLIFF_AMOUNT" /* EBAD_INPUT_CLIFF_AMOUNT */,
|
|
413
|
-
10: "EBAD_INPUT_PERIOD" /* EBAD_INPUT_PERIOD */,
|
|
414
|
-
11: "EBAD_INPUT_START" /* EBAD_INPUT_START */,
|
|
415
|
-
12: "ENO_RECIPIENT_COIN_ADDRESS" /* ENO_RECIPIENT_COIN_ADDRESS */
|
|
416
|
-
}
|
|
417
|
-
};
|
|
12
|
+
// solana/StreamClient.ts
|
|
418
13
|
var MAX_SAFE_UNIX_TIME_VALUE = 864e10;
|
|
419
|
-
var BASE_FEE = 1009900;
|
|
420
|
-
var WITHDRAW_AVAILABLE_AMOUNT = new BN7("18446744073709551615");
|
|
421
|
-
|
|
422
|
-
// common/contractUtils.ts
|
|
423
14
|
var calculateUnlockedAmount = ({
|
|
424
15
|
depositedAmount,
|
|
425
16
|
cliff,
|
|
@@ -432,15 +23,15 @@ var calculateUnlockedAmount = ({
|
|
|
432
23
|
fundsUnlockedAtLastRateChange
|
|
433
24
|
}) => {
|
|
434
25
|
const deposited = depositedAmount;
|
|
435
|
-
if (currentTimestamp < cliff) return new
|
|
26
|
+
if (currentTimestamp < cliff) return new BN3(0);
|
|
436
27
|
if (currentTimestamp > end) return deposited;
|
|
437
28
|
const savedUnlockedFunds = lastRateChangeTime === 0 ? cliffAmount : fundsUnlockedAtLastRateChange;
|
|
438
29
|
const savedUnlockedFundsTime = lastRateChangeTime === 0 ? cliff : lastRateChangeTime;
|
|
439
|
-
const streamed = new
|
|
30
|
+
const streamed = new BN3(Math.floor((currentTimestamp - savedUnlockedFundsTime) / period)).mul(amountPerPeriod).add(savedUnlockedFunds);
|
|
440
31
|
return streamed.lt(deposited) ? streamed : deposited;
|
|
441
32
|
};
|
|
442
33
|
var isCliffCloseToDepositedAmount = (streamData) => {
|
|
443
|
-
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new
|
|
34
|
+
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new BN3(1)));
|
|
444
35
|
};
|
|
445
36
|
var isPayment = (streamData) => {
|
|
446
37
|
return streamData.canTopup;
|
|
@@ -470,1951 +61,113 @@ var buildStreamType = (streamData) => {
|
|
|
470
61
|
return "payment" /* Payment */;
|
|
471
62
|
};
|
|
472
63
|
var decodeEndTime = (endTime) => {
|
|
473
|
-
if (endTime.gt(new
|
|
64
|
+
if (endTime.gt(new BN3(MAX_SAFE_UNIX_TIME_VALUE))) {
|
|
474
65
|
return MAX_SAFE_UNIX_TIME_VALUE;
|
|
475
66
|
}
|
|
476
67
|
return endTime.toNumber();
|
|
477
68
|
};
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
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
|
-
this.version = 0;
|
|
536
|
-
this.createdAt = parseInt(stream.created);
|
|
537
|
-
this.withdrawnAmount = new BN7(stream.withdrawn);
|
|
538
|
-
this.canceledAt = parseInt(stream.canceled_at);
|
|
539
|
-
this.end = parseInt(stream.end);
|
|
540
|
-
this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
|
|
541
|
-
this.sender = normalizeAptosAddress(stream.sender);
|
|
542
|
-
this.senderTokens = normalizeAptosAddress(stream.sender);
|
|
543
|
-
this.recipient = normalizeAptosAddress(stream.recipient);
|
|
544
|
-
this.recipientTokens = normalizeAptosAddress(stream.recipient);
|
|
545
|
-
this.mint = tokenId;
|
|
546
|
-
this.escrowTokens = "";
|
|
547
|
-
this.streamflowTreasury = "";
|
|
548
|
-
this.streamflowTreasuryTokens = "";
|
|
549
|
-
this.streamflowFeeTotal = new BN7(0);
|
|
550
|
-
this.streamflowFeeWithdrawn = new BN7(0);
|
|
551
|
-
this.streamflowFeePercent = parseInt(stream.fees.streamflow_fee_percentage) / 1e4;
|
|
552
|
-
this.partnerFeeTotal = new BN7(0);
|
|
553
|
-
this.partnerFeeWithdrawn = new BN7(0);
|
|
554
|
-
this.partnerFeePercent = 0;
|
|
555
|
-
this.partner = "";
|
|
556
|
-
this.partnerTokens = "";
|
|
557
|
-
this.start = parseInt(stream.start);
|
|
558
|
-
this.depositedAmount = new BN7(stream.amount);
|
|
559
|
-
this.period = parseInt(stream.period);
|
|
560
|
-
this.amountPerPeriod = new BN7(stream.amount_per_period);
|
|
561
|
-
this.cliff = parseInt(stream.start);
|
|
562
|
-
this.cliffAmount = new BN7(stream.cliff_amount);
|
|
563
|
-
this.cancelableBySender = stream.meta.cancelable_by_sender;
|
|
564
|
-
this.cancelableByRecipient = stream.meta.cancelable_by_recipient;
|
|
565
|
-
this.automaticWithdrawal = stream.meta.automatic_withdrawal;
|
|
566
|
-
this.transferableBySender = stream.meta.transferable_by_sender;
|
|
567
|
-
this.transferableByRecipient = stream.meta.transferable_by_recipient;
|
|
568
|
-
this.canTopup = stream.meta.can_topup;
|
|
569
|
-
const name = stream.meta.contract_name.replace("0x", "");
|
|
570
|
-
this.name = Buffer.from(name, "hex").toString("utf8");
|
|
571
|
-
this.withdrawalFrequency = parseInt(stream.meta.withdrawal_frequency);
|
|
572
|
-
this.closed = stream.closed;
|
|
573
|
-
this.currentPauseStart = parseInt(stream.current_pause_start);
|
|
574
|
-
this.pauseCumulative = new BN7(stream.pause_cumulative);
|
|
575
|
-
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
576
|
-
this.fundsUnlockedAtLastRateChange = new BN7(stream.funds_unlocked_at_last_rate_change);
|
|
577
|
-
this.type = buildStreamType(this);
|
|
578
|
-
}
|
|
579
|
-
unlocked(currentTimestamp) {
|
|
580
|
-
return calculateUnlockedAmount({
|
|
581
|
-
...this,
|
|
582
|
-
currentTimestamp
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
remaining(decimals) {
|
|
586
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
var AptosWalletWrapper = class {
|
|
590
|
-
constructor(wallet, client) {
|
|
591
|
-
this.client = client;
|
|
592
|
-
this.wallet = wallet;
|
|
593
|
-
if (wallet instanceof AptosAccount) {
|
|
594
|
-
this.address = wallet.address();
|
|
595
|
-
} else {
|
|
596
|
-
this.address = wallet.account.address;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
async signAndSubmitTransaction(input) {
|
|
600
|
-
if (this.wallet instanceof AptosAccount) {
|
|
601
|
-
const builder = new TransactionBuilderRemoteABI(this.client, {
|
|
602
|
-
sender: this.address
|
|
603
|
-
});
|
|
604
|
-
const rawTxn = await builder.build(input.function, input.type_arguments, input.arguments);
|
|
605
|
-
const res = await this.client.simulateTransaction(this.wallet, rawTxn);
|
|
606
|
-
if (!res[0].success) {
|
|
607
|
-
throw new Error(`Transaction Simulation failed: ${JSON.stringify(res)}`);
|
|
608
|
-
}
|
|
609
|
-
const signedTx = await this.client.signTransaction(this.wallet, rawTxn);
|
|
610
|
-
const tx = await this.client.submitSignedBCSTransaction(signedTx);
|
|
611
|
-
await this.client.waitForTransaction(tx.hash);
|
|
612
|
-
return tx.hash;
|
|
613
|
-
}
|
|
614
|
-
return (await this.wallet.signAndSubmitTransaction(input)).hash;
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
// aptos/StreamClient.ts
|
|
619
|
-
var AptosStreamClient = class extends BaseStreamClient {
|
|
620
|
-
constructor(clusterUrl, cluster = ICluster.Mainnet, maxGas = "10000", programId) {
|
|
621
|
-
super();
|
|
622
|
-
this.programId = programId ? programId : APTOS_PROGRAM_IDS[cluster];
|
|
623
|
-
this.maxGas = maxGas;
|
|
624
|
-
this.client = new AptosClient(clusterUrl);
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Creates a new stream/vesting contract.
|
|
628
|
-
*/
|
|
629
|
-
async create(streamData, { senderWallet }) {
|
|
630
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
631
|
-
const result = this.generateMultiPayloads(
|
|
632
|
-
{
|
|
633
|
-
...streamData,
|
|
634
|
-
recipients: [{ ...streamData }]
|
|
635
|
-
},
|
|
636
|
-
wallet
|
|
637
|
-
)[0];
|
|
638
|
-
if (!result) {
|
|
639
|
-
throw new Error("Failed to generate payload");
|
|
640
|
-
}
|
|
641
|
-
const [metadataId, payload] = result;
|
|
642
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
643
|
-
return { ixs: [payload], txId: hash, metadataId };
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Creates multiple stream/vesting contracts.
|
|
647
|
-
*/
|
|
648
|
-
async createMultiple(multipleStreamData, { senderWallet }) {
|
|
649
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
650
|
-
const payloads = this.generateMultiPayloads(multipleStreamData, wallet);
|
|
651
|
-
const txs = [];
|
|
652
|
-
const metadatas = [];
|
|
653
|
-
const metadataToRecipient = {};
|
|
654
|
-
const errors = [];
|
|
655
|
-
for (let i = 0; i < payloads.length; i++) {
|
|
656
|
-
const [metadataId, payload] = payloads[i];
|
|
657
|
-
const recipient = multipleStreamData.recipients[i];
|
|
658
|
-
try {
|
|
659
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
660
|
-
txs.push(hash);
|
|
661
|
-
} catch (e) {
|
|
662
|
-
errors.push({
|
|
663
|
-
error: e?.toString() ?? "Unknown error!",
|
|
664
|
-
recipient: recipient.recipient
|
|
665
|
-
});
|
|
666
|
-
} finally {
|
|
667
|
-
metadatas.push(metadataId);
|
|
668
|
-
metadataToRecipient[metadataId] = recipient;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
return {
|
|
672
|
-
txs,
|
|
673
|
-
metadatas,
|
|
674
|
-
metadataToRecipient,
|
|
675
|
-
errors
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* Attempts withdrawing from the specified stream.
|
|
680
|
-
*/
|
|
681
|
-
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { senderWallet, tokenId }) {
|
|
682
|
-
const payload = {
|
|
683
|
-
type: "withdraw",
|
|
684
|
-
function: `${this.programId}::protocol::withdraw`,
|
|
685
|
-
type_arguments: [tokenId],
|
|
686
|
-
arguments: [id, amount.toString()]
|
|
687
|
-
};
|
|
688
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
689
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
690
|
-
return { ixs: [payload], txId: hash };
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Attempts canceling the specified stream.
|
|
694
|
-
*/
|
|
695
|
-
async cancel(cancelData, { senderWallet, tokenId }) {
|
|
696
|
-
const payload = {
|
|
697
|
-
type: "cancel",
|
|
698
|
-
function: `${this.programId}::protocol::cancel`,
|
|
699
|
-
type_arguments: [tokenId],
|
|
700
|
-
arguments: [cancelData.id]
|
|
701
|
-
};
|
|
702
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
703
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
704
|
-
return { ixs: [payload], txId: hash };
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
708
|
-
*/
|
|
709
|
-
async transfer(transferData, { senderWallet, tokenId }) {
|
|
710
|
-
const payload = {
|
|
711
|
-
type: "transfer",
|
|
712
|
-
function: `${this.programId}::protocol::transfer`,
|
|
713
|
-
type_arguments: [tokenId],
|
|
714
|
-
arguments: [transferData.id, transferData.newRecipient]
|
|
715
|
-
};
|
|
716
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
717
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
718
|
-
return { ixs: [payload], txId: hash };
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* Tops up stream account with specified amount.
|
|
722
|
-
*/
|
|
723
|
-
async topup(topupData, { senderWallet, tokenId }) {
|
|
724
|
-
const payload = {
|
|
725
|
-
type: "topup",
|
|
726
|
-
function: `${this.programId}::protocol::topup`,
|
|
727
|
-
type_arguments: [tokenId],
|
|
728
|
-
arguments: [topupData.id, topupData.amount.toString()]
|
|
729
|
-
};
|
|
730
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
731
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
732
|
-
return { ixs: [payload], txId: hash };
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Fetch stream data by its id (address).
|
|
736
|
-
*/
|
|
737
|
-
async getOne({ id }) {
|
|
738
|
-
const contractResources = await this.client.getAccountResources(id);
|
|
739
|
-
const contract = contractResources.find((r) => r.type.includes("protocol::Contract"));
|
|
740
|
-
if (!contract) {
|
|
741
|
-
throw new Error(`Contract with id ${id} could not be found!`);
|
|
742
|
-
}
|
|
743
|
-
const tokenIdMatch = contract.type.match(/0x[0-9a-f]+::protocol::Contract<(.*)>/);
|
|
744
|
-
const tokenId = tokenIdMatch?.[1] ?? "";
|
|
745
|
-
const { data } = contract;
|
|
746
|
-
return new Contract(data, tokenId);
|
|
747
|
-
}
|
|
748
|
-
async get() {
|
|
749
|
-
throw new Error("Get all method is not supported for Aptos chain!");
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
753
|
-
*/
|
|
754
|
-
async update(updateData, { senderWallet, tokenId }) {
|
|
755
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
756
|
-
const payload = {
|
|
757
|
-
type: "update",
|
|
758
|
-
function: `${this.programId}::protocol::update`,
|
|
759
|
-
type_arguments: [tokenId],
|
|
760
|
-
arguments: [
|
|
761
|
-
updateData.id,
|
|
762
|
-
updateData.enableAutomaticWithdrawal ? [true] : [],
|
|
763
|
-
updateData.withdrawFrequency ? [updateData.withdrawFrequency.toString()] : [],
|
|
764
|
-
updateData.amountPerPeriod ? [updateData.amountPerPeriod.toString()] : []
|
|
765
|
-
]
|
|
766
|
-
};
|
|
767
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
768
|
-
return { ixs: [payload], txId: hash };
|
|
769
|
-
}
|
|
770
|
-
async getFees({ address }) {
|
|
771
|
-
const resource = await this.client.getAccountResource(this.programId, `${this.programId}::fees::FeeTable`);
|
|
772
|
-
const data = resource.data;
|
|
773
|
-
const value = await this.client.getTableItem(data.values.handle, {
|
|
774
|
-
key_type: "address",
|
|
775
|
-
key: address,
|
|
776
|
-
value_type: "u64"
|
|
777
|
-
});
|
|
778
|
-
if (!value) {
|
|
779
|
-
return null;
|
|
780
|
-
}
|
|
781
|
-
return { streamflowFee: Number(value) / 100, partnerFee: 0 };
|
|
782
|
-
}
|
|
783
|
-
async getDefaultStreamflowFee() {
|
|
784
|
-
const resource = await this.client.getAccountResource(this.programId, `${this.programId}::admin::ConfigV2`);
|
|
785
|
-
return Number(resource.data.streamflow_fees) / 100;
|
|
786
|
-
}
|
|
787
|
-
extractErrorCode(err) {
|
|
788
|
-
return extractAptosErrorCode(err.toString() ?? "Unknown error!");
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* Returns StreamClient protocol program ID.
|
|
792
|
-
*/
|
|
793
|
-
getProgramId() {
|
|
794
|
-
return this.programId;
|
|
795
|
-
}
|
|
796
|
-
getMaxGas() {
|
|
797
|
-
return { max_gas_amount: this.maxGas };
|
|
798
|
-
}
|
|
799
|
-
// Utility function to prepare transaction payloads for multiple recipients.
|
|
800
|
-
generateMultiPayloads(multipleStreamData, wallet) {
|
|
801
|
-
return multipleStreamData.recipients.map((recipient) => {
|
|
802
|
-
const acc = new AptosAccount();
|
|
803
|
-
const seeds = acc.address();
|
|
804
|
-
const encoder = new TextEncoder();
|
|
805
|
-
const actualSeeds = encoder.encode(seeds.hex());
|
|
806
|
-
const metadataId = AptosAccount.getResourceAccountAddress(wallet.address, actualSeeds);
|
|
807
|
-
return [
|
|
808
|
-
metadataId.toString(),
|
|
809
|
-
{
|
|
810
|
-
type: "create",
|
|
811
|
-
function: `${this.programId}::protocol::create`,
|
|
812
|
-
type_arguments: [multipleStreamData.tokenId],
|
|
813
|
-
arguments: [
|
|
814
|
-
seeds.hex(),
|
|
815
|
-
recipient.amount.toString(),
|
|
816
|
-
multipleStreamData.period,
|
|
817
|
-
recipient.amountPerPeriod.toString(),
|
|
818
|
-
multipleStreamData.start,
|
|
819
|
-
recipient.cliffAmount.toString(),
|
|
820
|
-
multipleStreamData.cancelableBySender,
|
|
821
|
-
multipleStreamData.cancelableByRecipient,
|
|
822
|
-
multipleStreamData.transferableBySender,
|
|
823
|
-
multipleStreamData.transferableByRecipient,
|
|
824
|
-
multipleStreamData.canTopup,
|
|
825
|
-
multipleStreamData.canPause || false,
|
|
826
|
-
multipleStreamData.canUpdateRate || false,
|
|
827
|
-
multipleStreamData.automaticWithdrawal || false,
|
|
828
|
-
multipleStreamData.withdrawalFrequency || 0,
|
|
829
|
-
recipient.name,
|
|
830
|
-
recipient.recipient
|
|
831
|
-
]
|
|
832
|
-
}
|
|
833
|
-
];
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
|
|
838
|
-
// evm/index.ts
|
|
839
|
-
var evm_exports = {};
|
|
840
|
-
__export(evm_exports, {
|
|
841
|
-
EvmContract: () => EvmContract,
|
|
842
|
-
EvmStreamClient: () => EvmStreamClient,
|
|
843
|
-
constants: () => constants_exports2,
|
|
844
|
-
default: () => EvmStreamClient,
|
|
845
|
-
ercAbi: () => ercAbi_default,
|
|
846
|
-
extractEvmErrorCode: () => extractEvmErrorCode
|
|
847
|
-
});
|
|
848
|
-
|
|
849
|
-
// evm/constants.ts
|
|
850
|
-
var constants_exports2 = {};
|
|
851
|
-
__export(constants_exports2, {
|
|
852
|
-
BNB_PROGRAM_IDS: () => BNB_PROGRAM_IDS,
|
|
853
|
-
ETHEREUM_PROGRAM_IDS: () => ETHEREUM_PROGRAM_IDS,
|
|
854
|
-
EVM_ERROR_MAP: () => EVM_ERROR_MAP,
|
|
855
|
-
EVM_ERROR_MATCH_REGEX: () => EVM_ERROR_MATCH_REGEX,
|
|
856
|
-
POLYGON_PROGRAM_IDS: () => POLYGON_PROGRAM_IDS
|
|
857
|
-
});
|
|
858
|
-
var ETHEREUM_PROGRAM_IDS = {
|
|
859
|
-
[ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
860
|
-
[ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
861
|
-
[ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
862
|
-
[ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d"
|
|
863
|
-
};
|
|
864
|
-
var BNB_PROGRAM_IDS = {
|
|
865
|
-
[ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
866
|
-
[ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
867
|
-
[ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
868
|
-
[ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d"
|
|
869
|
-
};
|
|
870
|
-
var POLYGON_PROGRAM_IDS = {
|
|
871
|
-
[ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
872
|
-
[ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
873
|
-
[ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
874
|
-
[ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d"
|
|
875
|
-
};
|
|
876
|
-
var EVM_ERROR_MATCH_REGEX = /execution reverted: ([A-Z_]+)/;
|
|
877
|
-
var EVM_ERROR_MAP = {
|
|
878
|
-
ECONTRACT_NOT_INIT: "ECONTRACT_NOT_INIT" /* ECONTRACT_NOT_INIT */,
|
|
879
|
-
EBAD_AMOUNT: "EBAD_AMOUNT" /* EBAD_AMOUNT */,
|
|
880
|
-
ENO_PERMISSIONS: "ENO_PERMISSIONS" /* ENO_PERMISSIONS */,
|
|
881
|
-
EBADINPUT: "EBADINPUT" /* EBADINPUT */,
|
|
882
|
-
ECLOSED: "ECLOSED" /* ECLOSED */,
|
|
883
|
-
EBAD_INPUT_AMOUNT_PER_PERIOD: "EBAD_INPUT_AMOUNT_PER_PERIOD" /* EBAD_INPUT_AMOUNT_PER_PERIOD */,
|
|
884
|
-
EBAD_INPUT_PAUSABLE: "EBAD_INPUT_PAUSABLE" /* EBAD_INPUT_PAUSABLE */,
|
|
885
|
-
EBAD_INPUT_UPDATE_RATE: "EBAD_INPUT_UPDATE_RATE" /* EBAD_INPUT_UPDATE_RATE */,
|
|
886
|
-
EBAD_INPUT_CLIFF_AMOUNT: "EBAD_INPUT_CLIFF_AMOUNT" /* EBAD_INPUT_CLIFF_AMOUNT */,
|
|
887
|
-
EBAD_INPUT_PERIOD: "EBAD_INPUT_PERIOD" /* EBAD_INPUT_PERIOD */,
|
|
888
|
-
EBAD_INPUT_START: "EBAD_INPUT_START" /* EBAD_INPUT_START */,
|
|
889
|
-
EBAD_INSUFFICIENT_TOKEN_ALLOWANCE: "EBAD_INSUFFICIENT_TOKEN_ALLOWANCE" /* EBAD_INSUFFICIENT_TOKEN_ALLOWANCE */,
|
|
890
|
-
EBAD_INSUFFICIENT_WITHDRAWAL_FEES: "EBAD_INSUFFICIENT_WITHDRAWAL_FEES" /* EBAD_INSUFFICIENT_WITHDRAWAL_FEES */
|
|
891
|
-
};
|
|
892
|
-
|
|
893
|
-
// evm/abi.ts
|
|
894
|
-
var abi_default = [
|
|
895
|
-
{
|
|
896
|
-
anonymous: false,
|
|
897
|
-
inputs: [
|
|
898
|
-
{
|
|
899
|
-
indexed: false,
|
|
900
|
-
internalType: "address",
|
|
901
|
-
name: "",
|
|
902
|
-
type: "address"
|
|
903
|
-
}
|
|
904
|
-
],
|
|
905
|
-
name: "ContractCreated",
|
|
906
|
-
type: "event"
|
|
907
|
-
},
|
|
908
|
-
{
|
|
909
|
-
inputs: [
|
|
910
|
-
{
|
|
911
|
-
internalType: "address",
|
|
912
|
-
name: "_stream_id",
|
|
913
|
-
type: "address"
|
|
914
|
-
}
|
|
915
|
-
],
|
|
916
|
-
name: "cancel",
|
|
917
|
-
outputs: [],
|
|
918
|
-
stateMutability: "nonpayable",
|
|
919
|
-
type: "function"
|
|
920
|
-
},
|
|
921
|
-
{
|
|
922
|
-
inputs: [
|
|
923
|
-
{
|
|
924
|
-
internalType: "uint256",
|
|
925
|
-
name: "_new_fees",
|
|
926
|
-
type: "uint256"
|
|
927
|
-
}
|
|
928
|
-
],
|
|
929
|
-
name: "changeStreamflowFees",
|
|
930
|
-
outputs: [],
|
|
931
|
-
stateMutability: "nonpayable",
|
|
932
|
-
type: "function"
|
|
933
|
-
},
|
|
934
|
-
{
|
|
935
|
-
inputs: [
|
|
936
|
-
{
|
|
937
|
-
internalType: "address payable",
|
|
938
|
-
name: "_new_treasury",
|
|
939
|
-
type: "address"
|
|
940
|
-
}
|
|
941
|
-
],
|
|
942
|
-
name: "changeTreasury",
|
|
943
|
-
outputs: [],
|
|
944
|
-
stateMutability: "nonpayable",
|
|
945
|
-
type: "function"
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
inputs: [
|
|
949
|
-
{
|
|
950
|
-
internalType: "uint256",
|
|
951
|
-
name: "_new_fee",
|
|
952
|
-
type: "uint256"
|
|
953
|
-
}
|
|
954
|
-
],
|
|
955
|
-
name: "changeTxFee",
|
|
956
|
-
outputs: [],
|
|
957
|
-
stateMutability: "nonpayable",
|
|
958
|
-
type: "function"
|
|
959
|
-
},
|
|
960
|
-
{
|
|
961
|
-
inputs: [
|
|
962
|
-
{
|
|
963
|
-
internalType: "address payable",
|
|
964
|
-
name: "_new_withdawor",
|
|
965
|
-
type: "address"
|
|
966
|
-
}
|
|
967
|
-
],
|
|
968
|
-
name: "changeWithdrawor",
|
|
969
|
-
outputs: [],
|
|
970
|
-
stateMutability: "nonpayable",
|
|
971
|
-
type: "function"
|
|
972
|
-
},
|
|
973
|
-
{
|
|
974
|
-
inputs: [],
|
|
975
|
-
name: "config",
|
|
976
|
-
outputs: [
|
|
977
|
-
{
|
|
978
|
-
internalType: "address",
|
|
979
|
-
name: "admin",
|
|
980
|
-
type: "address"
|
|
981
|
-
},
|
|
982
|
-
{
|
|
983
|
-
internalType: "uint256",
|
|
984
|
-
name: "streamflow_fees",
|
|
985
|
-
type: "uint256"
|
|
986
|
-
},
|
|
987
|
-
{
|
|
988
|
-
internalType: "address payable",
|
|
989
|
-
name: "treasury",
|
|
990
|
-
type: "address"
|
|
991
|
-
},
|
|
992
|
-
{
|
|
993
|
-
internalType: "address payable",
|
|
994
|
-
name: "withdrawor",
|
|
995
|
-
type: "address"
|
|
996
|
-
},
|
|
997
|
-
{
|
|
998
|
-
internalType: "uint256",
|
|
999
|
-
name: "tx_fee",
|
|
1000
|
-
type: "uint256"
|
|
1001
|
-
}
|
|
1002
|
-
],
|
|
1003
|
-
stateMutability: "view",
|
|
1004
|
-
type: "function"
|
|
1005
|
-
},
|
|
1006
|
-
{
|
|
1007
|
-
inputs: [
|
|
1008
|
-
{
|
|
1009
|
-
internalType: "contract IERC20",
|
|
1010
|
-
name: "_token",
|
|
1011
|
-
type: "address"
|
|
1012
|
-
},
|
|
1013
|
-
{
|
|
1014
|
-
internalType: "uint256",
|
|
1015
|
-
name: "_amount",
|
|
1016
|
-
type: "uint256"
|
|
1017
|
-
},
|
|
1018
|
-
{
|
|
1019
|
-
internalType: "uint256",
|
|
1020
|
-
name: "_period",
|
|
1021
|
-
type: "uint256"
|
|
1022
|
-
},
|
|
1023
|
-
{
|
|
1024
|
-
internalType: "uint256",
|
|
1025
|
-
name: "_amount_per_period",
|
|
1026
|
-
type: "uint256"
|
|
1027
|
-
},
|
|
1028
|
-
{
|
|
1029
|
-
internalType: "uint256",
|
|
1030
|
-
name: "_start",
|
|
1031
|
-
type: "uint256"
|
|
1032
|
-
},
|
|
1033
|
-
{
|
|
1034
|
-
internalType: "uint256",
|
|
1035
|
-
name: "_cliff_amount",
|
|
1036
|
-
type: "uint256"
|
|
1037
|
-
},
|
|
1038
|
-
{
|
|
1039
|
-
components: [
|
|
1040
|
-
{
|
|
1041
|
-
internalType: "bool",
|
|
1042
|
-
name: "cancelable_by_sender",
|
|
1043
|
-
type: "bool"
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
internalType: "bool",
|
|
1047
|
-
name: "cancelable_by_recipient",
|
|
1048
|
-
type: "bool"
|
|
1049
|
-
},
|
|
1050
|
-
{
|
|
1051
|
-
internalType: "bool",
|
|
1052
|
-
name: "transferable_by_sender",
|
|
1053
|
-
type: "bool"
|
|
1054
|
-
},
|
|
1055
|
-
{
|
|
1056
|
-
internalType: "bool",
|
|
1057
|
-
name: "transferable_by_recipient",
|
|
1058
|
-
type: "bool"
|
|
1059
|
-
},
|
|
1060
|
-
{
|
|
1061
|
-
internalType: "bool",
|
|
1062
|
-
name: "can_topup",
|
|
1063
|
-
type: "bool"
|
|
1064
|
-
},
|
|
1065
|
-
{
|
|
1066
|
-
internalType: "bool",
|
|
1067
|
-
name: "pausable",
|
|
1068
|
-
type: "bool"
|
|
1069
|
-
},
|
|
1070
|
-
{
|
|
1071
|
-
internalType: "bool",
|
|
1072
|
-
name: "can_update_rate",
|
|
1073
|
-
type: "bool"
|
|
1074
|
-
},
|
|
1075
|
-
{
|
|
1076
|
-
internalType: "bool",
|
|
1077
|
-
name: "automatic_withdrawal",
|
|
1078
|
-
type: "bool"
|
|
1079
|
-
},
|
|
1080
|
-
{
|
|
1081
|
-
internalType: "uint256",
|
|
1082
|
-
name: "withdrawal_frequency",
|
|
1083
|
-
type: "uint256"
|
|
1084
|
-
},
|
|
1085
|
-
{
|
|
1086
|
-
internalType: "string",
|
|
1087
|
-
name: "contract_name",
|
|
1088
|
-
type: "string"
|
|
1089
|
-
}
|
|
1090
|
-
],
|
|
1091
|
-
internalType: "struct ContractMeta",
|
|
1092
|
-
name: "_meta",
|
|
1093
|
-
type: "tuple"
|
|
1094
|
-
},
|
|
1095
|
-
{
|
|
1096
|
-
internalType: "address",
|
|
1097
|
-
name: "_recipient",
|
|
1098
|
-
type: "address"
|
|
1099
|
-
},
|
|
1100
|
-
{
|
|
1101
|
-
internalType: "address",
|
|
1102
|
-
name: "_partner",
|
|
1103
|
-
type: "address"
|
|
1104
|
-
}
|
|
1105
|
-
],
|
|
1106
|
-
name: "create",
|
|
1107
|
-
outputs: [],
|
|
1108
|
-
stateMutability: "payable",
|
|
1109
|
-
type: "function"
|
|
1110
|
-
},
|
|
1111
|
-
{
|
|
1112
|
-
inputs: [
|
|
1113
|
-
{
|
|
1114
|
-
internalType: "address",
|
|
1115
|
-
name: "_address",
|
|
1116
|
-
type: "address"
|
|
1117
|
-
}
|
|
1118
|
-
],
|
|
1119
|
-
name: "feesRemove",
|
|
1120
|
-
outputs: [],
|
|
1121
|
-
stateMutability: "nonpayable",
|
|
1122
|
-
type: "function"
|
|
1123
|
-
},
|
|
1124
|
-
{
|
|
1125
|
-
inputs: [
|
|
1126
|
-
{
|
|
1127
|
-
internalType: "address",
|
|
1128
|
-
name: "_address",
|
|
1129
|
-
type: "address"
|
|
1130
|
-
},
|
|
1131
|
-
{
|
|
1132
|
-
internalType: "uint256",
|
|
1133
|
-
name: "streamflow_fee",
|
|
1134
|
-
type: "uint256"
|
|
1135
|
-
},
|
|
1136
|
-
{
|
|
1137
|
-
internalType: "uint256",
|
|
1138
|
-
name: "partner_fee",
|
|
1139
|
-
type: "uint256"
|
|
1140
|
-
}
|
|
1141
|
-
],
|
|
1142
|
-
name: "feesWrite",
|
|
1143
|
-
outputs: [],
|
|
1144
|
-
stateMutability: "nonpayable",
|
|
1145
|
-
type: "function"
|
|
1146
|
-
},
|
|
1147
|
-
{
|
|
1148
|
-
inputs: [],
|
|
1149
|
-
name: "getAdmin",
|
|
1150
|
-
outputs: [
|
|
1151
|
-
{
|
|
1152
|
-
internalType: "address",
|
|
1153
|
-
name: "",
|
|
1154
|
-
type: "address"
|
|
1155
|
-
}
|
|
1156
|
-
],
|
|
1157
|
-
stateMutability: "view",
|
|
1158
|
-
type: "function"
|
|
1159
|
-
},
|
|
1160
|
-
{
|
|
1161
|
-
inputs: [],
|
|
1162
|
-
name: "getAll",
|
|
1163
|
-
outputs: [
|
|
1164
|
-
{
|
|
1165
|
-
internalType: "address[]",
|
|
1166
|
-
name: "",
|
|
1167
|
-
type: "address[]"
|
|
1168
|
-
},
|
|
1169
|
-
{
|
|
1170
|
-
components: [
|
|
1171
|
-
{
|
|
1172
|
-
internalType: "contract IERC20",
|
|
1173
|
-
name: "token",
|
|
1174
|
-
type: "address"
|
|
1175
|
-
},
|
|
1176
|
-
{
|
|
1177
|
-
components: [
|
|
1178
|
-
{
|
|
1179
|
-
internalType: "bool",
|
|
1180
|
-
name: "cancelable_by_sender",
|
|
1181
|
-
type: "bool"
|
|
1182
|
-
},
|
|
1183
|
-
{
|
|
1184
|
-
internalType: "bool",
|
|
1185
|
-
name: "cancelable_by_recipient",
|
|
1186
|
-
type: "bool"
|
|
1187
|
-
},
|
|
1188
|
-
{
|
|
1189
|
-
internalType: "bool",
|
|
1190
|
-
name: "transferable_by_sender",
|
|
1191
|
-
type: "bool"
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
internalType: "bool",
|
|
1195
|
-
name: "transferable_by_recipient",
|
|
1196
|
-
type: "bool"
|
|
1197
|
-
},
|
|
1198
|
-
{
|
|
1199
|
-
internalType: "bool",
|
|
1200
|
-
name: "can_topup",
|
|
1201
|
-
type: "bool"
|
|
1202
|
-
},
|
|
1203
|
-
{
|
|
1204
|
-
internalType: "bool",
|
|
1205
|
-
name: "pausable",
|
|
1206
|
-
type: "bool"
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
internalType: "bool",
|
|
1210
|
-
name: "can_update_rate",
|
|
1211
|
-
type: "bool"
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
internalType: "bool",
|
|
1215
|
-
name: "automatic_withdrawal",
|
|
1216
|
-
type: "bool"
|
|
1217
|
-
},
|
|
1218
|
-
{
|
|
1219
|
-
internalType: "uint256",
|
|
1220
|
-
name: "withdrawal_frequency",
|
|
1221
|
-
type: "uint256"
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
internalType: "string",
|
|
1225
|
-
name: "contract_name",
|
|
1226
|
-
type: "string"
|
|
1227
|
-
}
|
|
1228
|
-
],
|
|
1229
|
-
internalType: "struct ContractMeta",
|
|
1230
|
-
name: "meta",
|
|
1231
|
-
type: "tuple"
|
|
1232
|
-
},
|
|
1233
|
-
{
|
|
1234
|
-
internalType: "uint256",
|
|
1235
|
-
name: "amount",
|
|
1236
|
-
type: "uint256"
|
|
1237
|
-
},
|
|
1238
|
-
{
|
|
1239
|
-
internalType: "uint256",
|
|
1240
|
-
name: "period",
|
|
1241
|
-
type: "uint256"
|
|
1242
|
-
},
|
|
1243
|
-
{
|
|
1244
|
-
internalType: "uint256",
|
|
1245
|
-
name: "amount_per_period",
|
|
1246
|
-
type: "uint256"
|
|
1247
|
-
},
|
|
1248
|
-
{
|
|
1249
|
-
internalType: "uint256",
|
|
1250
|
-
name: "start",
|
|
1251
|
-
type: "uint256"
|
|
1252
|
-
},
|
|
1253
|
-
{
|
|
1254
|
-
internalType: "uint256",
|
|
1255
|
-
name: "end",
|
|
1256
|
-
type: "uint256"
|
|
1257
|
-
},
|
|
1258
|
-
{
|
|
1259
|
-
internalType: "uint256",
|
|
1260
|
-
name: "cliff_amount",
|
|
1261
|
-
type: "uint256"
|
|
1262
|
-
},
|
|
1263
|
-
{
|
|
1264
|
-
internalType: "uint256",
|
|
1265
|
-
name: "withdrawn",
|
|
1266
|
-
type: "uint256"
|
|
1267
|
-
},
|
|
1268
|
-
{
|
|
1269
|
-
internalType: "uint256",
|
|
1270
|
-
name: "last_withdrawn_at",
|
|
1271
|
-
type: "uint256"
|
|
1272
|
-
},
|
|
1273
|
-
{
|
|
1274
|
-
internalType: "uint256",
|
|
1275
|
-
name: "created",
|
|
1276
|
-
type: "uint256"
|
|
1277
|
-
},
|
|
1278
|
-
{
|
|
1279
|
-
internalType: "uint256",
|
|
1280
|
-
name: "canceled_at",
|
|
1281
|
-
type: "uint256"
|
|
1282
|
-
},
|
|
1283
|
-
{
|
|
1284
|
-
internalType: "address",
|
|
1285
|
-
name: "recipient",
|
|
1286
|
-
type: "address"
|
|
1287
|
-
},
|
|
1288
|
-
{
|
|
1289
|
-
internalType: "address",
|
|
1290
|
-
name: "sender",
|
|
1291
|
-
type: "address"
|
|
1292
|
-
},
|
|
1293
|
-
{
|
|
1294
|
-
internalType: "address",
|
|
1295
|
-
name: "partner",
|
|
1296
|
-
type: "address"
|
|
1297
|
-
},
|
|
1298
|
-
{
|
|
1299
|
-
components: [
|
|
1300
|
-
{
|
|
1301
|
-
internalType: "uint256",
|
|
1302
|
-
name: "streamflow_fee_percentage",
|
|
1303
|
-
type: "uint256"
|
|
1304
|
-
},
|
|
1305
|
-
{
|
|
1306
|
-
internalType: "uint256",
|
|
1307
|
-
name: "streamflow_fee",
|
|
1308
|
-
type: "uint256"
|
|
1309
|
-
},
|
|
1310
|
-
{
|
|
1311
|
-
internalType: "uint256",
|
|
1312
|
-
name: "streamflow_fee_withdrawn",
|
|
1313
|
-
type: "uint256"
|
|
1314
|
-
},
|
|
1315
|
-
{
|
|
1316
|
-
internalType: "uint256",
|
|
1317
|
-
name: "partner_fee_percentage",
|
|
1318
|
-
type: "uint256"
|
|
1319
|
-
},
|
|
1320
|
-
{
|
|
1321
|
-
internalType: "uint256",
|
|
1322
|
-
name: "partner_fee",
|
|
1323
|
-
type: "uint256"
|
|
1324
|
-
},
|
|
1325
|
-
{
|
|
1326
|
-
internalType: "uint256",
|
|
1327
|
-
name: "partner_fee_withdrawn",
|
|
1328
|
-
type: "uint256"
|
|
1329
|
-
},
|
|
1330
|
-
{
|
|
1331
|
-
internalType: "uint256",
|
|
1332
|
-
name: "tx_fee",
|
|
1333
|
-
type: "uint256"
|
|
1334
|
-
}
|
|
1335
|
-
],
|
|
1336
|
-
internalType: "struct FeesData",
|
|
1337
|
-
name: "fees",
|
|
1338
|
-
type: "tuple"
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
internalType: "bool",
|
|
1342
|
-
name: "closed",
|
|
1343
|
-
type: "bool"
|
|
1344
|
-
},
|
|
1345
|
-
{
|
|
1346
|
-
internalType: "uint256",
|
|
1347
|
-
name: "current_pause_start",
|
|
1348
|
-
type: "uint256"
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
internalType: "uint256",
|
|
1352
|
-
name: "pause_cumulative",
|
|
1353
|
-
type: "uint256"
|
|
1354
|
-
},
|
|
1355
|
-
{
|
|
1356
|
-
internalType: "uint256",
|
|
1357
|
-
name: "last_rate_change_time",
|
|
1358
|
-
type: "uint256"
|
|
1359
|
-
},
|
|
1360
|
-
{
|
|
1361
|
-
internalType: "uint256",
|
|
1362
|
-
name: "funds_unlocked_at_last_rate_change",
|
|
1363
|
-
type: "uint256"
|
|
1364
|
-
}
|
|
1365
|
-
],
|
|
1366
|
-
internalType: "struct Contract[]",
|
|
1367
|
-
name: "",
|
|
1368
|
-
type: "tuple[]"
|
|
1369
|
-
}
|
|
1370
|
-
],
|
|
1371
|
-
stateMutability: "view",
|
|
1372
|
-
type: "function"
|
|
1373
|
-
},
|
|
1374
|
-
{
|
|
1375
|
-
inputs: [
|
|
1376
|
-
{
|
|
1377
|
-
internalType: "address",
|
|
1378
|
-
name: "_id",
|
|
1379
|
-
type: "address"
|
|
1380
|
-
}
|
|
1381
|
-
],
|
|
1382
|
-
name: "getById",
|
|
1383
|
-
outputs: [
|
|
1384
|
-
{
|
|
1385
|
-
components: [
|
|
1386
|
-
{
|
|
1387
|
-
internalType: "contract IERC20",
|
|
1388
|
-
name: "token",
|
|
1389
|
-
type: "address"
|
|
1390
|
-
},
|
|
1391
|
-
{
|
|
1392
|
-
components: [
|
|
1393
|
-
{
|
|
1394
|
-
internalType: "bool",
|
|
1395
|
-
name: "cancelable_by_sender",
|
|
1396
|
-
type: "bool"
|
|
1397
|
-
},
|
|
1398
|
-
{
|
|
1399
|
-
internalType: "bool",
|
|
1400
|
-
name: "cancelable_by_recipient",
|
|
1401
|
-
type: "bool"
|
|
1402
|
-
},
|
|
1403
|
-
{
|
|
1404
|
-
internalType: "bool",
|
|
1405
|
-
name: "transferable_by_sender",
|
|
1406
|
-
type: "bool"
|
|
1407
|
-
},
|
|
1408
|
-
{
|
|
1409
|
-
internalType: "bool",
|
|
1410
|
-
name: "transferable_by_recipient",
|
|
1411
|
-
type: "bool"
|
|
1412
|
-
},
|
|
1413
|
-
{
|
|
1414
|
-
internalType: "bool",
|
|
1415
|
-
name: "can_topup",
|
|
1416
|
-
type: "bool"
|
|
1417
|
-
},
|
|
1418
|
-
{
|
|
1419
|
-
internalType: "bool",
|
|
1420
|
-
name: "pausable",
|
|
1421
|
-
type: "bool"
|
|
1422
|
-
},
|
|
1423
|
-
{
|
|
1424
|
-
internalType: "bool",
|
|
1425
|
-
name: "can_update_rate",
|
|
1426
|
-
type: "bool"
|
|
1427
|
-
},
|
|
1428
|
-
{
|
|
1429
|
-
internalType: "bool",
|
|
1430
|
-
name: "automatic_withdrawal",
|
|
1431
|
-
type: "bool"
|
|
1432
|
-
},
|
|
1433
|
-
{
|
|
1434
|
-
internalType: "uint256",
|
|
1435
|
-
name: "withdrawal_frequency",
|
|
1436
|
-
type: "uint256"
|
|
1437
|
-
},
|
|
1438
|
-
{
|
|
1439
|
-
internalType: "string",
|
|
1440
|
-
name: "contract_name",
|
|
1441
|
-
type: "string"
|
|
1442
|
-
}
|
|
1443
|
-
],
|
|
1444
|
-
internalType: "struct ContractMeta",
|
|
1445
|
-
name: "meta",
|
|
1446
|
-
type: "tuple"
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
internalType: "uint256",
|
|
1450
|
-
name: "amount",
|
|
1451
|
-
type: "uint256"
|
|
1452
|
-
},
|
|
1453
|
-
{
|
|
1454
|
-
internalType: "uint256",
|
|
1455
|
-
name: "period",
|
|
1456
|
-
type: "uint256"
|
|
1457
|
-
},
|
|
1458
|
-
{
|
|
1459
|
-
internalType: "uint256",
|
|
1460
|
-
name: "amount_per_period",
|
|
1461
|
-
type: "uint256"
|
|
1462
|
-
},
|
|
1463
|
-
{
|
|
1464
|
-
internalType: "uint256",
|
|
1465
|
-
name: "start",
|
|
1466
|
-
type: "uint256"
|
|
1467
|
-
},
|
|
1468
|
-
{
|
|
1469
|
-
internalType: "uint256",
|
|
1470
|
-
name: "end",
|
|
1471
|
-
type: "uint256"
|
|
1472
|
-
},
|
|
1473
|
-
{
|
|
1474
|
-
internalType: "uint256",
|
|
1475
|
-
name: "cliff_amount",
|
|
1476
|
-
type: "uint256"
|
|
1477
|
-
},
|
|
1478
|
-
{
|
|
1479
|
-
internalType: "uint256",
|
|
1480
|
-
name: "withdrawn",
|
|
1481
|
-
type: "uint256"
|
|
1482
|
-
},
|
|
1483
|
-
{
|
|
1484
|
-
internalType: "uint256",
|
|
1485
|
-
name: "last_withdrawn_at",
|
|
1486
|
-
type: "uint256"
|
|
1487
|
-
},
|
|
1488
|
-
{
|
|
1489
|
-
internalType: "uint256",
|
|
1490
|
-
name: "created",
|
|
1491
|
-
type: "uint256"
|
|
1492
|
-
},
|
|
1493
|
-
{
|
|
1494
|
-
internalType: "uint256",
|
|
1495
|
-
name: "canceled_at",
|
|
1496
|
-
type: "uint256"
|
|
1497
|
-
},
|
|
1498
|
-
{
|
|
1499
|
-
internalType: "address",
|
|
1500
|
-
name: "recipient",
|
|
1501
|
-
type: "address"
|
|
1502
|
-
},
|
|
1503
|
-
{
|
|
1504
|
-
internalType: "address",
|
|
1505
|
-
name: "sender",
|
|
1506
|
-
type: "address"
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
internalType: "address",
|
|
1510
|
-
name: "partner",
|
|
1511
|
-
type: "address"
|
|
1512
|
-
},
|
|
1513
|
-
{
|
|
1514
|
-
components: [
|
|
1515
|
-
{
|
|
1516
|
-
internalType: "uint256",
|
|
1517
|
-
name: "streamflow_fee_percentage",
|
|
1518
|
-
type: "uint256"
|
|
1519
|
-
},
|
|
1520
|
-
{
|
|
1521
|
-
internalType: "uint256",
|
|
1522
|
-
name: "streamflow_fee",
|
|
1523
|
-
type: "uint256"
|
|
1524
|
-
},
|
|
1525
|
-
{
|
|
1526
|
-
internalType: "uint256",
|
|
1527
|
-
name: "streamflow_fee_withdrawn",
|
|
1528
|
-
type: "uint256"
|
|
1529
|
-
},
|
|
1530
|
-
{
|
|
1531
|
-
internalType: "uint256",
|
|
1532
|
-
name: "partner_fee_percentage",
|
|
1533
|
-
type: "uint256"
|
|
1534
|
-
},
|
|
1535
|
-
{
|
|
1536
|
-
internalType: "uint256",
|
|
1537
|
-
name: "partner_fee",
|
|
1538
|
-
type: "uint256"
|
|
1539
|
-
},
|
|
1540
|
-
{
|
|
1541
|
-
internalType: "uint256",
|
|
1542
|
-
name: "partner_fee_withdrawn",
|
|
1543
|
-
type: "uint256"
|
|
1544
|
-
},
|
|
1545
|
-
{
|
|
1546
|
-
internalType: "uint256",
|
|
1547
|
-
name: "tx_fee",
|
|
1548
|
-
type: "uint256"
|
|
1549
|
-
}
|
|
1550
|
-
],
|
|
1551
|
-
internalType: "struct FeesData",
|
|
1552
|
-
name: "fees",
|
|
1553
|
-
type: "tuple"
|
|
1554
|
-
},
|
|
1555
|
-
{
|
|
1556
|
-
internalType: "bool",
|
|
1557
|
-
name: "closed",
|
|
1558
|
-
type: "bool"
|
|
1559
|
-
},
|
|
1560
|
-
{
|
|
1561
|
-
internalType: "uint256",
|
|
1562
|
-
name: "current_pause_start",
|
|
1563
|
-
type: "uint256"
|
|
1564
|
-
},
|
|
1565
|
-
{
|
|
1566
|
-
internalType: "uint256",
|
|
1567
|
-
name: "pause_cumulative",
|
|
1568
|
-
type: "uint256"
|
|
1569
|
-
},
|
|
1570
|
-
{
|
|
1571
|
-
internalType: "uint256",
|
|
1572
|
-
name: "last_rate_change_time",
|
|
1573
|
-
type: "uint256"
|
|
1574
|
-
},
|
|
1575
|
-
{
|
|
1576
|
-
internalType: "uint256",
|
|
1577
|
-
name: "funds_unlocked_at_last_rate_change",
|
|
1578
|
-
type: "uint256"
|
|
1579
|
-
}
|
|
1580
|
-
],
|
|
1581
|
-
internalType: "struct Contract",
|
|
1582
|
-
name: "",
|
|
1583
|
-
type: "tuple"
|
|
1584
|
-
}
|
|
1585
|
-
],
|
|
1586
|
-
stateMutability: "view",
|
|
1587
|
-
type: "function"
|
|
1588
|
-
},
|
|
1589
|
-
{
|
|
1590
|
-
inputs: [
|
|
1591
|
-
{
|
|
1592
|
-
internalType: "address",
|
|
1593
|
-
name: "_recipient",
|
|
1594
|
-
type: "address"
|
|
1595
|
-
}
|
|
1596
|
-
],
|
|
1597
|
-
name: "getByRecipient",
|
|
1598
|
-
outputs: [
|
|
1599
|
-
{
|
|
1600
|
-
internalType: "address[]",
|
|
1601
|
-
name: "",
|
|
1602
|
-
type: "address[]"
|
|
1603
|
-
}
|
|
1604
|
-
],
|
|
1605
|
-
stateMutability: "view",
|
|
1606
|
-
type: "function"
|
|
1607
|
-
},
|
|
1608
|
-
{
|
|
1609
|
-
inputs: [
|
|
1610
|
-
{
|
|
1611
|
-
internalType: "address",
|
|
1612
|
-
name: "_sender",
|
|
1613
|
-
type: "address"
|
|
1614
|
-
}
|
|
1615
|
-
],
|
|
1616
|
-
name: "getBySender",
|
|
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: "_address",
|
|
1632
|
-
type: "address"
|
|
1633
|
-
}
|
|
1634
|
-
],
|
|
1635
|
-
name: "getFees",
|
|
1636
|
-
outputs: [
|
|
1637
|
-
{
|
|
1638
|
-
components: [
|
|
1639
|
-
{
|
|
1640
|
-
internalType: "bool",
|
|
1641
|
-
name: "exists",
|
|
1642
|
-
type: "bool"
|
|
1643
|
-
},
|
|
1644
|
-
{
|
|
1645
|
-
internalType: "uint256",
|
|
1646
|
-
name: "streamflow_fee",
|
|
1647
|
-
type: "uint256"
|
|
1648
|
-
},
|
|
1649
|
-
{
|
|
1650
|
-
internalType: "uint256",
|
|
1651
|
-
name: "partner_fee",
|
|
1652
|
-
type: "uint256"
|
|
1653
|
-
}
|
|
1654
|
-
],
|
|
1655
|
-
internalType: "struct StreamflowFeeManager.FeeValue",
|
|
1656
|
-
name: "",
|
|
1657
|
-
type: "tuple"
|
|
1658
|
-
}
|
|
1659
|
-
],
|
|
1660
|
-
stateMutability: "view",
|
|
1661
|
-
type: "function"
|
|
1662
|
-
},
|
|
1663
|
-
{
|
|
1664
|
-
inputs: [
|
|
1665
|
-
{
|
|
1666
|
-
internalType: "address[]",
|
|
1667
|
-
name: "_ids",
|
|
1668
|
-
type: "address[]"
|
|
1669
|
-
}
|
|
1670
|
-
],
|
|
1671
|
-
name: "getMultiple",
|
|
1672
|
-
outputs: [
|
|
1673
|
-
{
|
|
1674
|
-
components: [
|
|
1675
|
-
{
|
|
1676
|
-
internalType: "contract IERC20",
|
|
1677
|
-
name: "token",
|
|
1678
|
-
type: "address"
|
|
1679
|
-
},
|
|
1680
|
-
{
|
|
1681
|
-
components: [
|
|
1682
|
-
{
|
|
1683
|
-
internalType: "bool",
|
|
1684
|
-
name: "cancelable_by_sender",
|
|
1685
|
-
type: "bool"
|
|
1686
|
-
},
|
|
1687
|
-
{
|
|
1688
|
-
internalType: "bool",
|
|
1689
|
-
name: "cancelable_by_recipient",
|
|
1690
|
-
type: "bool"
|
|
1691
|
-
},
|
|
1692
|
-
{
|
|
1693
|
-
internalType: "bool",
|
|
1694
|
-
name: "transferable_by_sender",
|
|
1695
|
-
type: "bool"
|
|
1696
|
-
},
|
|
1697
|
-
{
|
|
1698
|
-
internalType: "bool",
|
|
1699
|
-
name: "transferable_by_recipient",
|
|
1700
|
-
type: "bool"
|
|
1701
|
-
},
|
|
1702
|
-
{
|
|
1703
|
-
internalType: "bool",
|
|
1704
|
-
name: "can_topup",
|
|
1705
|
-
type: "bool"
|
|
1706
|
-
},
|
|
1707
|
-
{
|
|
1708
|
-
internalType: "bool",
|
|
1709
|
-
name: "pausable",
|
|
1710
|
-
type: "bool"
|
|
1711
|
-
},
|
|
1712
|
-
{
|
|
1713
|
-
internalType: "bool",
|
|
1714
|
-
name: "can_update_rate",
|
|
1715
|
-
type: "bool"
|
|
1716
|
-
},
|
|
1717
|
-
{
|
|
1718
|
-
internalType: "bool",
|
|
1719
|
-
name: "automatic_withdrawal",
|
|
1720
|
-
type: "bool"
|
|
1721
|
-
},
|
|
1722
|
-
{
|
|
1723
|
-
internalType: "uint256",
|
|
1724
|
-
name: "withdrawal_frequency",
|
|
1725
|
-
type: "uint256"
|
|
1726
|
-
},
|
|
1727
|
-
{
|
|
1728
|
-
internalType: "string",
|
|
1729
|
-
name: "contract_name",
|
|
1730
|
-
type: "string"
|
|
1731
|
-
}
|
|
1732
|
-
],
|
|
1733
|
-
internalType: "struct ContractMeta",
|
|
1734
|
-
name: "meta",
|
|
1735
|
-
type: "tuple"
|
|
1736
|
-
},
|
|
1737
|
-
{
|
|
1738
|
-
internalType: "uint256",
|
|
1739
|
-
name: "amount",
|
|
1740
|
-
type: "uint256"
|
|
1741
|
-
},
|
|
1742
|
-
{
|
|
1743
|
-
internalType: "uint256",
|
|
1744
|
-
name: "period",
|
|
1745
|
-
type: "uint256"
|
|
1746
|
-
},
|
|
1747
|
-
{
|
|
1748
|
-
internalType: "uint256",
|
|
1749
|
-
name: "amount_per_period",
|
|
1750
|
-
type: "uint256"
|
|
1751
|
-
},
|
|
1752
|
-
{
|
|
1753
|
-
internalType: "uint256",
|
|
1754
|
-
name: "start",
|
|
1755
|
-
type: "uint256"
|
|
1756
|
-
},
|
|
1757
|
-
{
|
|
1758
|
-
internalType: "uint256",
|
|
1759
|
-
name: "end",
|
|
1760
|
-
type: "uint256"
|
|
1761
|
-
},
|
|
1762
|
-
{
|
|
1763
|
-
internalType: "uint256",
|
|
1764
|
-
name: "cliff_amount",
|
|
1765
|
-
type: "uint256"
|
|
1766
|
-
},
|
|
1767
|
-
{
|
|
1768
|
-
internalType: "uint256",
|
|
1769
|
-
name: "withdrawn",
|
|
1770
|
-
type: "uint256"
|
|
1771
|
-
},
|
|
1772
|
-
{
|
|
1773
|
-
internalType: "uint256",
|
|
1774
|
-
name: "last_withdrawn_at",
|
|
1775
|
-
type: "uint256"
|
|
1776
|
-
},
|
|
1777
|
-
{
|
|
1778
|
-
internalType: "uint256",
|
|
1779
|
-
name: "created",
|
|
1780
|
-
type: "uint256"
|
|
1781
|
-
},
|
|
1782
|
-
{
|
|
1783
|
-
internalType: "uint256",
|
|
1784
|
-
name: "canceled_at",
|
|
1785
|
-
type: "uint256"
|
|
1786
|
-
},
|
|
1787
|
-
{
|
|
1788
|
-
internalType: "address",
|
|
1789
|
-
name: "recipient",
|
|
1790
|
-
type: "address"
|
|
1791
|
-
},
|
|
1792
|
-
{
|
|
1793
|
-
internalType: "address",
|
|
1794
|
-
name: "sender",
|
|
1795
|
-
type: "address"
|
|
1796
|
-
},
|
|
1797
|
-
{
|
|
1798
|
-
internalType: "address",
|
|
1799
|
-
name: "partner",
|
|
1800
|
-
type: "address"
|
|
1801
|
-
},
|
|
1802
|
-
{
|
|
1803
|
-
components: [
|
|
1804
|
-
{
|
|
1805
|
-
internalType: "uint256",
|
|
1806
|
-
name: "streamflow_fee_percentage",
|
|
1807
|
-
type: "uint256"
|
|
1808
|
-
},
|
|
1809
|
-
{
|
|
1810
|
-
internalType: "uint256",
|
|
1811
|
-
name: "streamflow_fee",
|
|
1812
|
-
type: "uint256"
|
|
1813
|
-
},
|
|
1814
|
-
{
|
|
1815
|
-
internalType: "uint256",
|
|
1816
|
-
name: "streamflow_fee_withdrawn",
|
|
1817
|
-
type: "uint256"
|
|
1818
|
-
},
|
|
1819
|
-
{
|
|
1820
|
-
internalType: "uint256",
|
|
1821
|
-
name: "partner_fee_percentage",
|
|
1822
|
-
type: "uint256"
|
|
1823
|
-
},
|
|
1824
|
-
{
|
|
1825
|
-
internalType: "uint256",
|
|
1826
|
-
name: "partner_fee",
|
|
1827
|
-
type: "uint256"
|
|
1828
|
-
},
|
|
1829
|
-
{
|
|
1830
|
-
internalType: "uint256",
|
|
1831
|
-
name: "partner_fee_withdrawn",
|
|
1832
|
-
type: "uint256"
|
|
1833
|
-
},
|
|
1834
|
-
{
|
|
1835
|
-
internalType: "uint256",
|
|
1836
|
-
name: "tx_fee",
|
|
1837
|
-
type: "uint256"
|
|
1838
|
-
}
|
|
1839
|
-
],
|
|
1840
|
-
internalType: "struct FeesData",
|
|
1841
|
-
name: "fees",
|
|
1842
|
-
type: "tuple"
|
|
1843
|
-
},
|
|
1844
|
-
{
|
|
1845
|
-
internalType: "bool",
|
|
1846
|
-
name: "closed",
|
|
1847
|
-
type: "bool"
|
|
1848
|
-
},
|
|
1849
|
-
{
|
|
1850
|
-
internalType: "uint256",
|
|
1851
|
-
name: "current_pause_start",
|
|
1852
|
-
type: "uint256"
|
|
1853
|
-
},
|
|
1854
|
-
{
|
|
1855
|
-
internalType: "uint256",
|
|
1856
|
-
name: "pause_cumulative",
|
|
1857
|
-
type: "uint256"
|
|
1858
|
-
},
|
|
1859
|
-
{
|
|
1860
|
-
internalType: "uint256",
|
|
1861
|
-
name: "last_rate_change_time",
|
|
1862
|
-
type: "uint256"
|
|
1863
|
-
},
|
|
1864
|
-
{
|
|
1865
|
-
internalType: "uint256",
|
|
1866
|
-
name: "funds_unlocked_at_last_rate_change",
|
|
1867
|
-
type: "uint256"
|
|
1868
|
-
}
|
|
1869
|
-
],
|
|
1870
|
-
internalType: "struct Contract[]",
|
|
1871
|
-
name: "",
|
|
1872
|
-
type: "tuple[]"
|
|
1873
|
-
}
|
|
1874
|
-
],
|
|
1875
|
-
stateMutability: "view",
|
|
1876
|
-
type: "function"
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
inputs: [
|
|
1880
|
-
{
|
|
1881
|
-
internalType: "address",
|
|
1882
|
-
name: "_address",
|
|
1883
|
-
type: "address"
|
|
1884
|
-
}
|
|
1885
|
-
],
|
|
1886
|
-
name: "getStreamflowFee",
|
|
1887
|
-
outputs: [
|
|
1888
|
-
{
|
|
1889
|
-
internalType: "uint256",
|
|
1890
|
-
name: "",
|
|
1891
|
-
type: "uint256"
|
|
1892
|
-
}
|
|
1893
|
-
],
|
|
1894
|
-
stateMutability: "view",
|
|
1895
|
-
type: "function"
|
|
1896
|
-
},
|
|
1897
|
-
{
|
|
1898
|
-
inputs: [],
|
|
1899
|
-
name: "getStreamflowFees",
|
|
1900
|
-
outputs: [
|
|
1901
|
-
{
|
|
1902
|
-
internalType: "uint256",
|
|
1903
|
-
name: "",
|
|
1904
|
-
type: "uint256"
|
|
1905
|
-
}
|
|
1906
|
-
],
|
|
1907
|
-
stateMutability: "view",
|
|
1908
|
-
type: "function"
|
|
1909
|
-
},
|
|
1910
|
-
{
|
|
1911
|
-
inputs: [
|
|
1912
|
-
{
|
|
1913
|
-
internalType: "address",
|
|
1914
|
-
name: "_stream_id",
|
|
1915
|
-
type: "address"
|
|
1916
|
-
},
|
|
1917
|
-
{
|
|
1918
|
-
internalType: "uint256",
|
|
1919
|
-
name: "_amount",
|
|
1920
|
-
type: "uint256"
|
|
1921
|
-
}
|
|
1922
|
-
],
|
|
1923
|
-
name: "getTopUpWithdrawalFees",
|
|
1924
|
-
outputs: [
|
|
1925
|
-
{
|
|
1926
|
-
components: [
|
|
1927
|
-
{
|
|
1928
|
-
internalType: "uint256",
|
|
1929
|
-
name: "value",
|
|
1930
|
-
type: "uint256"
|
|
1931
|
-
},
|
|
1932
|
-
{
|
|
1933
|
-
internalType: "uint256",
|
|
1934
|
-
name: "tx_fee",
|
|
1935
|
-
type: "uint256"
|
|
1936
|
-
}
|
|
1937
|
-
],
|
|
1938
|
-
internalType: "struct WithdrawalFeesData",
|
|
1939
|
-
name: "",
|
|
1940
|
-
type: "tuple"
|
|
1941
|
-
}
|
|
1942
|
-
],
|
|
1943
|
-
stateMutability: "view",
|
|
1944
|
-
type: "function"
|
|
1945
|
-
},
|
|
1946
|
-
{
|
|
1947
|
-
inputs: [],
|
|
1948
|
-
name: "getTreasuryAddress",
|
|
1949
|
-
outputs: [
|
|
1950
|
-
{
|
|
1951
|
-
internalType: "address payable",
|
|
1952
|
-
name: "",
|
|
1953
|
-
type: "address"
|
|
1954
|
-
}
|
|
1955
|
-
],
|
|
1956
|
-
stateMutability: "view",
|
|
1957
|
-
type: "function"
|
|
1958
|
-
},
|
|
1959
|
-
{
|
|
1960
|
-
inputs: [],
|
|
1961
|
-
name: "getTxFee",
|
|
1962
|
-
outputs: [
|
|
1963
|
-
{
|
|
1964
|
-
internalType: "uint256",
|
|
1965
|
-
name: "",
|
|
1966
|
-
type: "uint256"
|
|
1967
|
-
}
|
|
1968
|
-
],
|
|
1969
|
-
stateMutability: "view",
|
|
1970
|
-
type: "function"
|
|
1971
|
-
},
|
|
1972
|
-
{
|
|
1973
|
-
inputs: [
|
|
1974
|
-
{
|
|
1975
|
-
internalType: "uint256",
|
|
1976
|
-
name: "_amount",
|
|
1977
|
-
type: "uint256"
|
|
1978
|
-
},
|
|
1979
|
-
{
|
|
1980
|
-
internalType: "uint256",
|
|
1981
|
-
name: "_period",
|
|
1982
|
-
type: "uint256"
|
|
1983
|
-
},
|
|
1984
|
-
{
|
|
1985
|
-
internalType: "uint256",
|
|
1986
|
-
name: "_amount_per_period",
|
|
1987
|
-
type: "uint256"
|
|
1988
|
-
},
|
|
1989
|
-
{
|
|
1990
|
-
internalType: "uint256",
|
|
1991
|
-
name: "_start",
|
|
1992
|
-
type: "uint256"
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
internalType: "uint256",
|
|
1996
|
-
name: "_cliff_amount",
|
|
1997
|
-
type: "uint256"
|
|
1998
|
-
},
|
|
1999
|
-
{
|
|
2000
|
-
internalType: "bool",
|
|
2001
|
-
name: "_automatic_withdrawal",
|
|
2002
|
-
type: "bool"
|
|
2003
|
-
},
|
|
2004
|
-
{
|
|
2005
|
-
internalType: "uint256",
|
|
2006
|
-
name: "_withdrawal_frequency",
|
|
2007
|
-
type: "uint256"
|
|
2008
|
-
}
|
|
2009
|
-
],
|
|
2010
|
-
name: "getWithdrawalFees",
|
|
2011
|
-
outputs: [
|
|
2012
|
-
{
|
|
2013
|
-
components: [
|
|
2014
|
-
{
|
|
2015
|
-
internalType: "uint256",
|
|
2016
|
-
name: "value",
|
|
2017
|
-
type: "uint256"
|
|
2018
|
-
},
|
|
2019
|
-
{
|
|
2020
|
-
internalType: "uint256",
|
|
2021
|
-
name: "tx_fee",
|
|
2022
|
-
type: "uint256"
|
|
2023
|
-
}
|
|
2024
|
-
],
|
|
2025
|
-
internalType: "struct WithdrawalFeesData",
|
|
2026
|
-
name: "",
|
|
2027
|
-
type: "tuple"
|
|
2028
|
-
}
|
|
2029
|
-
],
|
|
2030
|
-
stateMutability: "view",
|
|
2031
|
-
type: "function"
|
|
2032
|
-
},
|
|
2033
|
-
{
|
|
2034
|
-
inputs: [],
|
|
2035
|
-
name: "getWithdraworAddress",
|
|
2036
|
-
outputs: [
|
|
2037
|
-
{
|
|
2038
|
-
internalType: "address payable",
|
|
2039
|
-
name: "",
|
|
2040
|
-
type: "address"
|
|
2041
|
-
}
|
|
2042
|
-
],
|
|
2043
|
-
stateMutability: "view",
|
|
2044
|
-
type: "function"
|
|
2045
|
-
},
|
|
2046
|
-
{
|
|
2047
|
-
inputs: [],
|
|
2048
|
-
name: "initialize",
|
|
2049
|
-
outputs: [],
|
|
2050
|
-
stateMutability: "nonpayable",
|
|
2051
|
-
type: "function"
|
|
2052
|
-
},
|
|
2053
|
-
{
|
|
2054
|
-
inputs: [
|
|
2055
|
-
{
|
|
2056
|
-
internalType: "address",
|
|
2057
|
-
name: "_stream_id",
|
|
2058
|
-
type: "address"
|
|
2059
|
-
},
|
|
2060
|
-
{
|
|
2061
|
-
internalType: "uint256",
|
|
2062
|
-
name: "_amount",
|
|
2063
|
-
type: "uint256"
|
|
2064
|
-
}
|
|
2065
|
-
],
|
|
2066
|
-
name: "topUp",
|
|
2067
|
-
outputs: [],
|
|
2068
|
-
stateMutability: "payable",
|
|
2069
|
-
type: "function"
|
|
2070
|
-
},
|
|
2071
|
-
{
|
|
2072
|
-
inputs: [
|
|
2073
|
-
{
|
|
2074
|
-
internalType: "address",
|
|
2075
|
-
name: "_stream_id",
|
|
2076
|
-
type: "address"
|
|
2077
|
-
},
|
|
2078
|
-
{
|
|
2079
|
-
internalType: "address",
|
|
2080
|
-
name: "new_recipient",
|
|
2081
|
-
type: "address"
|
|
2082
|
-
}
|
|
2083
|
-
],
|
|
2084
|
-
name: "transfer",
|
|
2085
|
-
outputs: [],
|
|
2086
|
-
stateMutability: "nonpayable",
|
|
2087
|
-
type: "function"
|
|
2088
|
-
},
|
|
2089
|
-
{
|
|
2090
|
-
inputs: [
|
|
2091
|
-
{
|
|
2092
|
-
internalType: "address",
|
|
2093
|
-
name: "_new_admin",
|
|
2094
|
-
type: "address"
|
|
2095
|
-
}
|
|
2096
|
-
],
|
|
2097
|
-
name: "transferAdmin",
|
|
2098
|
-
outputs: [],
|
|
2099
|
-
stateMutability: "nonpayable",
|
|
2100
|
-
type: "function"
|
|
2101
|
-
},
|
|
2102
|
-
{
|
|
2103
|
-
inputs: [
|
|
2104
|
-
{
|
|
2105
|
-
internalType: "address",
|
|
2106
|
-
name: "_stream_id",
|
|
2107
|
-
type: "address"
|
|
2108
|
-
},
|
|
2109
|
-
{
|
|
2110
|
-
internalType: "bool[]",
|
|
2111
|
-
name: "_automatic_withdrawal",
|
|
2112
|
-
type: "bool[]"
|
|
2113
|
-
},
|
|
2114
|
-
{
|
|
2115
|
-
internalType: "uint256[]",
|
|
2116
|
-
name: "_withdrawal_frequency",
|
|
2117
|
-
type: "uint256[]"
|
|
2118
|
-
},
|
|
2119
|
-
{
|
|
2120
|
-
internalType: "uint256[]",
|
|
2121
|
-
name: "_amount_per_period",
|
|
2122
|
-
type: "uint256[]"
|
|
2123
|
-
}
|
|
2124
|
-
],
|
|
2125
|
-
name: "update",
|
|
2126
|
-
outputs: [],
|
|
2127
|
-
stateMutability: "payable",
|
|
2128
|
-
type: "function"
|
|
2129
|
-
},
|
|
2130
|
-
{
|
|
2131
|
-
inputs: [
|
|
2132
|
-
{
|
|
2133
|
-
internalType: "address",
|
|
2134
|
-
name: "_stream_id",
|
|
2135
|
-
type: "address"
|
|
2136
|
-
},
|
|
2137
|
-
{
|
|
2138
|
-
internalType: "uint256",
|
|
2139
|
-
name: "_amount",
|
|
2140
|
-
type: "uint256"
|
|
2141
|
-
}
|
|
2142
|
-
],
|
|
2143
|
-
name: "withdraw",
|
|
2144
|
-
outputs: [],
|
|
2145
|
-
stateMutability: "nonpayable",
|
|
2146
|
-
type: "function"
|
|
2147
|
-
}
|
|
2148
|
-
];
|
|
2149
|
-
|
|
2150
|
-
// evm/ercAbi.ts
|
|
2151
|
-
var ercAbi_default = [
|
|
2152
|
-
{
|
|
2153
|
-
constant: true,
|
|
2154
|
-
inputs: [],
|
|
2155
|
-
name: "name",
|
|
2156
|
-
outputs: [
|
|
2157
|
-
{
|
|
2158
|
-
name: "",
|
|
2159
|
-
type: "string"
|
|
2160
|
-
}
|
|
2161
|
-
],
|
|
2162
|
-
payable: false,
|
|
2163
|
-
stateMutability: "view",
|
|
2164
|
-
type: "function"
|
|
2165
|
-
},
|
|
2166
|
-
{
|
|
2167
|
-
constant: false,
|
|
2168
|
-
inputs: [
|
|
2169
|
-
{
|
|
2170
|
-
name: "_spender",
|
|
2171
|
-
type: "address"
|
|
2172
|
-
},
|
|
2173
|
-
{
|
|
2174
|
-
name: "_value",
|
|
2175
|
-
type: "uint256"
|
|
2176
|
-
}
|
|
2177
|
-
],
|
|
2178
|
-
name: "approve",
|
|
2179
|
-
outputs: [
|
|
2180
|
-
{
|
|
2181
|
-
name: "",
|
|
2182
|
-
type: "bool"
|
|
2183
|
-
}
|
|
2184
|
-
],
|
|
2185
|
-
payable: false,
|
|
2186
|
-
stateMutability: "nonpayable",
|
|
2187
|
-
type: "function"
|
|
2188
|
-
},
|
|
2189
|
-
{
|
|
2190
|
-
constant: true,
|
|
2191
|
-
inputs: [],
|
|
2192
|
-
name: "totalSupply",
|
|
2193
|
-
outputs: [
|
|
2194
|
-
{
|
|
2195
|
-
name: "",
|
|
2196
|
-
type: "uint256"
|
|
2197
|
-
}
|
|
2198
|
-
],
|
|
2199
|
-
payable: false,
|
|
2200
|
-
stateMutability: "view",
|
|
2201
|
-
type: "function"
|
|
2202
|
-
},
|
|
2203
|
-
{
|
|
2204
|
-
constant: false,
|
|
2205
|
-
inputs: [
|
|
2206
|
-
{
|
|
2207
|
-
name: "_from",
|
|
2208
|
-
type: "address"
|
|
2209
|
-
},
|
|
2210
|
-
{
|
|
2211
|
-
name: "_to",
|
|
2212
|
-
type: "address"
|
|
2213
|
-
},
|
|
2214
|
-
{
|
|
2215
|
-
name: "_value",
|
|
2216
|
-
type: "uint256"
|
|
2217
|
-
}
|
|
2218
|
-
],
|
|
2219
|
-
name: "transferFrom",
|
|
2220
|
-
outputs: [
|
|
2221
|
-
{
|
|
2222
|
-
name: "",
|
|
2223
|
-
type: "bool"
|
|
2224
|
-
}
|
|
2225
|
-
],
|
|
2226
|
-
payable: false,
|
|
2227
|
-
stateMutability: "nonpayable",
|
|
2228
|
-
type: "function"
|
|
2229
|
-
},
|
|
2230
|
-
{
|
|
2231
|
-
constant: true,
|
|
2232
|
-
inputs: [],
|
|
2233
|
-
name: "decimals",
|
|
2234
|
-
outputs: [
|
|
2235
|
-
{
|
|
2236
|
-
name: "",
|
|
2237
|
-
type: "uint8"
|
|
2238
|
-
}
|
|
2239
|
-
],
|
|
2240
|
-
payable: false,
|
|
2241
|
-
stateMutability: "view",
|
|
2242
|
-
type: "function"
|
|
2243
|
-
},
|
|
2244
|
-
{
|
|
2245
|
-
constant: true,
|
|
2246
|
-
inputs: [
|
|
2247
|
-
{
|
|
2248
|
-
name: "_owner",
|
|
2249
|
-
type: "address"
|
|
2250
|
-
}
|
|
2251
|
-
],
|
|
2252
|
-
name: "balanceOf",
|
|
2253
|
-
outputs: [
|
|
2254
|
-
{
|
|
2255
|
-
name: "balance",
|
|
2256
|
-
type: "uint256"
|
|
2257
|
-
}
|
|
2258
|
-
],
|
|
2259
|
-
payable: false,
|
|
2260
|
-
stateMutability: "view",
|
|
2261
|
-
type: "function"
|
|
2262
|
-
},
|
|
2263
|
-
{
|
|
2264
|
-
constant: true,
|
|
2265
|
-
inputs: [],
|
|
2266
|
-
name: "symbol",
|
|
2267
|
-
outputs: [
|
|
2268
|
-
{
|
|
2269
|
-
name: "",
|
|
2270
|
-
type: "string"
|
|
2271
|
-
}
|
|
2272
|
-
],
|
|
2273
|
-
payable: false,
|
|
2274
|
-
stateMutability: "view",
|
|
2275
|
-
type: "function"
|
|
2276
|
-
},
|
|
2277
|
-
{
|
|
2278
|
-
constant: false,
|
|
2279
|
-
inputs: [
|
|
2280
|
-
{
|
|
2281
|
-
name: "_to",
|
|
2282
|
-
type: "address"
|
|
2283
|
-
},
|
|
2284
|
-
{
|
|
2285
|
-
name: "_value",
|
|
2286
|
-
type: "uint256"
|
|
2287
|
-
}
|
|
2288
|
-
],
|
|
2289
|
-
name: "transfer",
|
|
2290
|
-
outputs: [
|
|
2291
|
-
{
|
|
2292
|
-
name: "",
|
|
2293
|
-
type: "bool"
|
|
2294
|
-
}
|
|
2295
|
-
],
|
|
2296
|
-
payable: false,
|
|
2297
|
-
stateMutability: "nonpayable",
|
|
2298
|
-
type: "function"
|
|
2299
|
-
},
|
|
2300
|
-
{
|
|
2301
|
-
constant: true,
|
|
2302
|
-
inputs: [
|
|
2303
|
-
{
|
|
2304
|
-
name: "_owner",
|
|
2305
|
-
type: "address"
|
|
2306
|
-
},
|
|
2307
|
-
{
|
|
2308
|
-
name: "_spender",
|
|
2309
|
-
type: "address"
|
|
2310
|
-
}
|
|
2311
|
-
],
|
|
2312
|
-
name: "allowance",
|
|
2313
|
-
outputs: [
|
|
2314
|
-
{
|
|
2315
|
-
name: "",
|
|
2316
|
-
type: "uint256"
|
|
2317
|
-
}
|
|
2318
|
-
],
|
|
2319
|
-
payable: false,
|
|
2320
|
-
stateMutability: "view",
|
|
2321
|
-
type: "function"
|
|
2322
|
-
},
|
|
2323
|
-
{
|
|
2324
|
-
payable: true,
|
|
2325
|
-
stateMutability: "payable",
|
|
2326
|
-
type: "fallback"
|
|
2327
|
-
},
|
|
2328
|
-
{
|
|
2329
|
-
anonymous: false,
|
|
2330
|
-
inputs: [
|
|
2331
|
-
{
|
|
2332
|
-
indexed: true,
|
|
2333
|
-
name: "owner",
|
|
2334
|
-
type: "address"
|
|
2335
|
-
},
|
|
2336
|
-
{
|
|
2337
|
-
indexed: true,
|
|
2338
|
-
name: "spender",
|
|
2339
|
-
type: "address"
|
|
2340
|
-
},
|
|
2341
|
-
{
|
|
2342
|
-
indexed: false,
|
|
2343
|
-
name: "value",
|
|
2344
|
-
type: "uint256"
|
|
2345
|
-
}
|
|
2346
|
-
],
|
|
2347
|
-
name: "Approval",
|
|
2348
|
-
type: "event"
|
|
2349
|
-
},
|
|
2350
|
-
{
|
|
2351
|
-
anonymous: false,
|
|
2352
|
-
inputs: [
|
|
2353
|
-
{
|
|
2354
|
-
indexed: true,
|
|
2355
|
-
name: "from",
|
|
2356
|
-
type: "address"
|
|
2357
|
-
},
|
|
2358
|
-
{
|
|
2359
|
-
indexed: true,
|
|
2360
|
-
name: "to",
|
|
2361
|
-
type: "address"
|
|
2362
|
-
},
|
|
2363
|
-
{
|
|
2364
|
-
indexed: false,
|
|
2365
|
-
name: "value",
|
|
2366
|
-
type: "uint256"
|
|
2367
|
-
}
|
|
2368
|
-
],
|
|
2369
|
-
name: "Transfer",
|
|
2370
|
-
type: "event"
|
|
2371
|
-
}
|
|
2372
|
-
];
|
|
2373
|
-
var EvmContract = class {
|
|
69
|
+
var ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
70
|
+
var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
|
|
71
|
+
StreamDirection2["Outgoing"] = "outgoing";
|
|
72
|
+
StreamDirection2["Incoming"] = "incoming";
|
|
73
|
+
StreamDirection2["All"] = "all";
|
|
74
|
+
return StreamDirection2;
|
|
75
|
+
})(StreamDirection || {});
|
|
76
|
+
var StreamType = /* @__PURE__ */ ((StreamType2) => {
|
|
77
|
+
StreamType2["All"] = "all";
|
|
78
|
+
StreamType2["Payment"] = "payment";
|
|
79
|
+
StreamType2["Vesting"] = "vesting";
|
|
80
|
+
StreamType2["Lock"] = "lock";
|
|
81
|
+
return StreamType2;
|
|
82
|
+
})(StreamType || {});
|
|
83
|
+
var ContractErrorCode = /* @__PURE__ */ ((ContractErrorCode2) => {
|
|
84
|
+
ContractErrorCode2["AccountsNotWritable"] = "AccountsNotWritable";
|
|
85
|
+
ContractErrorCode2["InvalidMetadata"] = "InvalidMetadata";
|
|
86
|
+
ContractErrorCode2["InvalidMetadataAccount"] = "InvalidMetadataAccount";
|
|
87
|
+
ContractErrorCode2["MetadataAccountMismatch"] = "MetadataAccountMismatch";
|
|
88
|
+
ContractErrorCode2["InvalidEscrowAccount"] = "InvalidEscrowAccount";
|
|
89
|
+
ContractErrorCode2["NotAssociated"] = "NotAssociated";
|
|
90
|
+
ContractErrorCode2["MintMismatch"] = "MintMismatch";
|
|
91
|
+
ContractErrorCode2["TransferNotAllowed"] = "TransferNotAllowed";
|
|
92
|
+
ContractErrorCode2["ContractClosed"] = "ContractClosed";
|
|
93
|
+
ContractErrorCode2["InvalidTreasury"] = "InvalidTreasury";
|
|
94
|
+
ContractErrorCode2["InvalidTimestamps"] = "InvalidTimestamps";
|
|
95
|
+
ContractErrorCode2["InvalidDepositConfiguration"] = "InvalidDepositConfiguration";
|
|
96
|
+
ContractErrorCode2["AmountIsZero"] = "AmountIsZero";
|
|
97
|
+
ContractErrorCode2["AmountMoreThanAvailable"] = "AmountMoreThanAvailable";
|
|
98
|
+
ContractErrorCode2["AmountAvailableIsZero"] = "AmountAvailableIsZero";
|
|
99
|
+
ContractErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
100
|
+
ContractErrorCode2["InvalidMetadataSize"] = "InvalidMetadataSize";
|
|
101
|
+
ContractErrorCode2["UninitializedMetadata"] = "UninitializedMetadata";
|
|
102
|
+
ContractErrorCode2["Unauthorized"] = "Unauthorized";
|
|
103
|
+
ContractErrorCode2["SelfTransfer"] = "SelfTransfer";
|
|
104
|
+
ContractErrorCode2["AlreadyPaused"] = "AlreadyPaused";
|
|
105
|
+
ContractErrorCode2["NotPaused"] = "NotPaused";
|
|
106
|
+
ContractErrorCode2["MetadataNotRentExempt"] = "MetadataNotRentExempt";
|
|
107
|
+
return ContractErrorCode2;
|
|
108
|
+
})(ContractErrorCode || {});
|
|
109
|
+
var AlignedProxyErrorCode = /* @__PURE__ */ ((AlignedProxyErrorCode2) => {
|
|
110
|
+
AlignedProxyErrorCode2["Unauthorized"] = "Unauthorized";
|
|
111
|
+
AlignedProxyErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
112
|
+
AlignedProxyErrorCode2["UnsupportedTokenExtensions"] = "UnsupportedTokenExtensions";
|
|
113
|
+
AlignedProxyErrorCode2["PeriodTooShort"] = "PeriodTooShort";
|
|
114
|
+
AlignedProxyErrorCode2["InvalidTickSize"] = "InvalidTickSize";
|
|
115
|
+
AlignedProxyErrorCode2["InvalidPercentageBoundaries"] = "InvalidPercentageBoundaries";
|
|
116
|
+
AlignedProxyErrorCode2["InvalidPriceBoundaries"] = "InvalidPriceBoundaries";
|
|
117
|
+
AlignedProxyErrorCode2["UnsupportedOracle"] = "UnsupportedOracle";
|
|
118
|
+
AlignedProxyErrorCode2["InvalidOracleAccount"] = "InvalidOracleAccount";
|
|
119
|
+
AlignedProxyErrorCode2["InvalidOraclePrice"] = "InvalidOraclePrice";
|
|
120
|
+
AlignedProxyErrorCode2["InvalidStreamMetadata"] = "InvalidStreamMetadata";
|
|
121
|
+
AlignedProxyErrorCode2["AmountAlreadyUpdated"] = "AmountAlreadyUpdated";
|
|
122
|
+
AlignedProxyErrorCode2["AllFundsUnlocked"] = "AllFundsUnlocked";
|
|
123
|
+
return AlignedProxyErrorCode2;
|
|
124
|
+
})(AlignedProxyErrorCode || {});
|
|
125
|
+
var Contract = class {
|
|
2374
126
|
constructor(stream) {
|
|
2375
|
-
this.magic =
|
|
2376
|
-
this.version =
|
|
2377
|
-
this.createdAt = stream.
|
|
2378
|
-
this.withdrawnAmount =
|
|
2379
|
-
this.canceledAt = stream.
|
|
2380
|
-
this.end = stream.end
|
|
2381
|
-
this.lastWithdrawnAt = stream.
|
|
2382
|
-
this.sender = stream.sender;
|
|
2383
|
-
this.senderTokens = stream.
|
|
2384
|
-
this.recipient = stream.recipient;
|
|
2385
|
-
this.recipientTokens = stream.
|
|
2386
|
-
this.mint = stream.
|
|
2387
|
-
this.escrowTokens =
|
|
2388
|
-
this.streamflowTreasury =
|
|
2389
|
-
this.streamflowTreasuryTokens =
|
|
2390
|
-
this.streamflowFeeTotal =
|
|
2391
|
-
this.streamflowFeeWithdrawn =
|
|
2392
|
-
this.streamflowFeePercent = stream.
|
|
2393
|
-
this.partnerFeeTotal =
|
|
2394
|
-
this.partnerFeeWithdrawn =
|
|
2395
|
-
this.partnerFeePercent =
|
|
2396
|
-
this.partner =
|
|
2397
|
-
this.partnerTokens =
|
|
127
|
+
this.magic = stream.magic.toNumber();
|
|
128
|
+
this.version = stream.version.toNumber();
|
|
129
|
+
this.createdAt = stream.createdAt.toNumber();
|
|
130
|
+
this.withdrawnAmount = stream.withdrawnAmount;
|
|
131
|
+
this.canceledAt = stream.canceledAt.toNumber();
|
|
132
|
+
this.end = decodeEndTime(stream.end);
|
|
133
|
+
this.lastWithdrawnAt = stream.lastWithdrawnAt.toNumber();
|
|
134
|
+
this.sender = stream.sender.toBase58();
|
|
135
|
+
this.senderTokens = stream.senderTokens.toBase58();
|
|
136
|
+
this.recipient = stream.recipient.toBase58();
|
|
137
|
+
this.recipientTokens = stream.recipientTokens.toBase58();
|
|
138
|
+
this.mint = stream.mint.toBase58();
|
|
139
|
+
this.escrowTokens = stream.escrowTokens.toBase58();
|
|
140
|
+
this.streamflowTreasury = stream.streamflowTreasury.toBase58();
|
|
141
|
+
this.streamflowTreasuryTokens = stream.streamflowTreasuryTokens.toBase58();
|
|
142
|
+
this.streamflowFeeTotal = stream.streamflowFeeTotal;
|
|
143
|
+
this.streamflowFeeWithdrawn = stream.streamflowFeeWithdrawn;
|
|
144
|
+
this.streamflowFeePercent = stream.streamflowFeePercent;
|
|
145
|
+
this.partnerFeeTotal = stream.partnerFeeTotal;
|
|
146
|
+
this.partnerFeeWithdrawn = stream.partnerFeeWithdrawn;
|
|
147
|
+
this.partnerFeePercent = stream.partnerFeePercent;
|
|
148
|
+
this.partner = stream.partner.toBase58();
|
|
149
|
+
this.partnerTokens = stream.partnerTokens?.toBase58();
|
|
2398
150
|
this.start = stream.start.toNumber();
|
|
2399
|
-
this.depositedAmount =
|
|
151
|
+
this.depositedAmount = stream.depositedAmount;
|
|
2400
152
|
this.period = stream.period.toNumber();
|
|
2401
|
-
this.amountPerPeriod =
|
|
2402
|
-
this.cliff = stream.
|
|
2403
|
-
this.cliffAmount =
|
|
2404
|
-
this.cancelableBySender = stream.
|
|
2405
|
-
this.cancelableByRecipient = stream.
|
|
2406
|
-
this.automaticWithdrawal = stream.
|
|
2407
|
-
this.transferableBySender = stream.
|
|
2408
|
-
this.transferableByRecipient = stream.
|
|
2409
|
-
this.canTopup = stream.
|
|
2410
|
-
this.name = stream.
|
|
2411
|
-
this.withdrawalFrequency = stream.
|
|
153
|
+
this.amountPerPeriod = stream.amountPerPeriod;
|
|
154
|
+
this.cliff = stream.cliff.toNumber();
|
|
155
|
+
this.cliffAmount = stream.cliffAmount;
|
|
156
|
+
this.cancelableBySender = stream.cancelableBySender;
|
|
157
|
+
this.cancelableByRecipient = stream.cancelableByRecipient;
|
|
158
|
+
this.automaticWithdrawal = stream.automaticWithdrawal;
|
|
159
|
+
this.transferableBySender = stream.transferableBySender;
|
|
160
|
+
this.transferableByRecipient = stream.transferableByRecipient;
|
|
161
|
+
this.canTopup = stream.canTopup;
|
|
162
|
+
this.name = stream.name;
|
|
163
|
+
this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
|
|
2412
164
|
this.closed = stream.closed;
|
|
2413
|
-
this.currentPauseStart = stream.
|
|
2414
|
-
this.pauseCumulative =
|
|
2415
|
-
this.lastRateChangeTime = stream.
|
|
2416
|
-
this.fundsUnlockedAtLastRateChange =
|
|
165
|
+
this.currentPauseStart = stream.currentPauseStart.toNumber();
|
|
166
|
+
this.pauseCumulative = stream.pauseCumulative;
|
|
167
|
+
this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
|
|
168
|
+
this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
|
|
2417
169
|
this.type = buildStreamType(this);
|
|
170
|
+
this.isAligned = false;
|
|
2418
171
|
}
|
|
2419
172
|
unlocked(currentTimestamp) {
|
|
2420
173
|
return calculateUnlockedAmount({
|
|
@@ -2426,313 +179,40 @@ var EvmContract = class {
|
|
|
2426
179
|
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
2427
180
|
}
|
|
2428
181
|
};
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
break;
|
|
2453
|
-
case IChain.BNB:
|
|
2454
|
-
this.programId = BNB_PROGRAM_IDS[cluster];
|
|
2455
|
-
break;
|
|
2456
|
-
case IChain.Polygon:
|
|
2457
|
-
this.programId = POLYGON_PROGRAM_IDS[cluster];
|
|
2458
|
-
break;
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
this.provider = new ethers.providers.JsonRpcProvider(clusterUrl);
|
|
2462
|
-
this.signer = signer;
|
|
2463
|
-
const baseContract = new ethers.Contract(this.programId, abi_default);
|
|
2464
|
-
this.readContract = baseContract.connect(this.provider);
|
|
2465
|
-
this.writeContract = baseContract.connect(this.signer);
|
|
2466
|
-
}
|
|
2467
|
-
async create(streamData) {
|
|
2468
|
-
const multiParams = {
|
|
2469
|
-
...streamData,
|
|
2470
|
-
recipients: [streamData]
|
|
2471
|
-
};
|
|
2472
|
-
const fees = await this.readContract.getWithdrawalFees(...this.getFeeParams(multiParams));
|
|
2473
|
-
const args = (await this.generateMultiPayloads(multiParams))[0];
|
|
2474
|
-
const sum = streamData.amount.mul(new BN7(BASE_FEE)).div(new BN7(1e6));
|
|
2475
|
-
await this.approveTokens(streamData.tokenId, sum);
|
|
2476
|
-
const result = await this.writeContract.create(...args, {
|
|
2477
|
-
value: fees.value
|
|
2478
|
-
});
|
|
2479
|
-
const confirmedTx = await result.wait();
|
|
2480
|
-
const metadataId = this.formatMetadataId(
|
|
2481
|
-
confirmedTx.events.find((item) => item.event === "ContractCreated").args[0]
|
|
2482
|
-
);
|
|
2483
|
-
return {
|
|
2484
|
-
ixs: [],
|
|
2485
|
-
txId: result.hash,
|
|
2486
|
-
metadataId
|
|
2487
|
-
};
|
|
2488
|
-
}
|
|
2489
|
-
async createMultiple(multipleStreamData) {
|
|
2490
|
-
const fees = await this.readContract.getWithdrawalFees(...this.getFeeParams(multipleStreamData));
|
|
2491
|
-
const args = await this.generateMultiPayloads(multipleStreamData);
|
|
2492
|
-
const sum = multipleStreamData.recipients.reduce((acc, v) => acc.add(v.amount), new BN7(0)).mul(new BN7(BASE_FEE)).div(new BN7(1e6));
|
|
2493
|
-
await this.approveTokens(multipleStreamData.tokenId, sum);
|
|
2494
|
-
const creationPromises = args.map((item) => this.writeContract.create(...item, { value: fees.value }));
|
|
2495
|
-
const signatures = [];
|
|
2496
|
-
const results = await Promise.all(creationPromises);
|
|
2497
|
-
const confirmations = await Promise.allSettled(results.map((result) => result.wait()));
|
|
2498
|
-
const successes = confirmations.filter((el) => el.status === "fulfilled").map((el) => el.value);
|
|
2499
|
-
signatures.push(...successes.map((el) => el.hash));
|
|
2500
|
-
const metadatas = confirmations.map(
|
|
2501
|
-
(result) => result.status === "fulfilled" ? this.formatMetadataId(
|
|
2502
|
-
result.value.events.find((item) => item.event === "ContractCreated").args[0]
|
|
2503
|
-
) : null
|
|
2504
|
-
);
|
|
2505
|
-
const metadataToRecipient = metadatas.reduce(
|
|
2506
|
-
(acc, value, index) => {
|
|
2507
|
-
if (value) {
|
|
2508
|
-
acc[value] = multipleStreamData.recipients[index];
|
|
2509
|
-
}
|
|
2510
|
-
return acc;
|
|
2511
|
-
},
|
|
2512
|
-
{}
|
|
2513
|
-
);
|
|
2514
|
-
const failures = confirmations.filter((el) => el.status === "rejected").map((el) => el.reason);
|
|
2515
|
-
return {
|
|
2516
|
-
txs: signatures,
|
|
2517
|
-
metadatas: metadatas.filter(Boolean),
|
|
2518
|
-
metadataToRecipient,
|
|
2519
|
-
errors: failures
|
|
2520
|
-
};
|
|
2521
|
-
}
|
|
2522
|
-
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }) {
|
|
2523
|
-
const result = await this.writeContract.withdraw(id, amount.toString());
|
|
2524
|
-
return {
|
|
2525
|
-
ixs: [],
|
|
2526
|
-
txId: result.hash
|
|
2527
|
-
};
|
|
2528
|
-
}
|
|
2529
|
-
async cancel(cancelData) {
|
|
2530
|
-
const result = await this.writeContract.cancel(cancelData.id);
|
|
2531
|
-
return {
|
|
2532
|
-
ixs: [],
|
|
2533
|
-
txId: result.hash
|
|
2534
|
-
};
|
|
2535
|
-
}
|
|
2536
|
-
async transfer(transferData) {
|
|
2537
|
-
const result = await this.writeContract.transfer(transferData.id, transferData.newRecipient);
|
|
2538
|
-
return {
|
|
2539
|
-
ixs: [],
|
|
2540
|
-
txId: result.hash
|
|
2541
|
-
};
|
|
2542
|
-
}
|
|
2543
|
-
async topup(topupData) {
|
|
2544
|
-
const fees = await this.readContract.getTopUpWithdrawalFees(topupData.id, topupData.amount.toString());
|
|
2545
|
-
const sum = topupData.amount.mul(new BN7(BASE_FEE)).div(new BN7(1e6));
|
|
2546
|
-
const stream = await this.getOne({ id: topupData.id });
|
|
2547
|
-
await this.approveTokens(stream.mint, sum);
|
|
2548
|
-
const result = await this.writeContract.topUp(topupData.id, topupData.amount.toString(), {
|
|
2549
|
-
value: fees.value
|
|
2550
|
-
});
|
|
2551
|
-
return {
|
|
2552
|
-
ixs: [],
|
|
2553
|
-
txId: result.hash
|
|
2554
|
-
};
|
|
2555
|
-
}
|
|
2556
|
-
async update(updateData) {
|
|
2557
|
-
const result = await this.writeContract.update(
|
|
2558
|
-
updateData.id,
|
|
2559
|
-
updateData.enableAutomaticWithdrawal ? [true] : [],
|
|
2560
|
-
updateData.withdrawFrequency ? [updateData.withdrawFrequency.toString()] : [],
|
|
2561
|
-
updateData.amountPerPeriod ? [updateData.amountPerPeriod.toString()] : []
|
|
2562
|
-
);
|
|
2563
|
-
return {
|
|
2564
|
-
ixs: [],
|
|
2565
|
-
txId: result.hash
|
|
2566
|
-
};
|
|
2567
|
-
}
|
|
2568
|
-
async getOne({ id }) {
|
|
2569
|
-
const result = await this.readContract.getById(id);
|
|
2570
|
-
return new EvmContract(result);
|
|
2571
|
-
}
|
|
2572
|
-
async get({
|
|
2573
|
-
address,
|
|
2574
|
-
// type = StreamType.All,
|
|
2575
|
-
direction = "all" /* All */
|
|
2576
|
-
}) {
|
|
2577
|
-
const addresses = [];
|
|
2578
|
-
if (direction === "all" /* All */ || direction === "outgoing" /* Outgoing */) {
|
|
2579
|
-
const senderAddresses = await this.readContract.getBySender(address);
|
|
2580
|
-
addresses.push(...senderAddresses);
|
|
2581
|
-
}
|
|
2582
|
-
if (direction === "all" /* All */ || direction === "incoming" /* Incoming */) {
|
|
2583
|
-
const recipientAddresses = await this.readContract.getByRecipient(address);
|
|
2584
|
-
addresses.push(...recipientAddresses);
|
|
2585
|
-
}
|
|
2586
|
-
const uniqueAddresses = [...new Set(addresses)];
|
|
2587
|
-
const results = await this.readContract.getMultiple(uniqueAddresses);
|
|
2588
|
-
return results.map((result, index) => [uniqueAddresses[index], new EvmContract(result)]);
|
|
2589
|
-
}
|
|
2590
|
-
extractErrorCode(err) {
|
|
2591
|
-
return extractEvmErrorCode(err.toString() ?? "Unknown error!");
|
|
2592
|
-
}
|
|
2593
|
-
async getFees({ address }) {
|
|
2594
|
-
const fees = await this.readContract.getFees(address);
|
|
2595
|
-
if (!fees.exists) {
|
|
2596
|
-
return null;
|
|
2597
|
-
}
|
|
2598
|
-
return {
|
|
2599
|
-
streamflowFee: fees.streamflow_fee.toNumber() / 100,
|
|
2600
|
-
partnerFee: fees.partner_fee.toNumber() / 100
|
|
2601
|
-
};
|
|
2602
|
-
}
|
|
2603
|
-
async getDefaultStreamflowFee() {
|
|
2604
|
-
const fee = await this.readContract.getStreamflowFees();
|
|
2605
|
-
return fee.toNumber() / 100;
|
|
2606
|
-
}
|
|
2607
|
-
/**
|
|
2608
|
-
* Returns StreamClient protocol program ID.
|
|
2609
|
-
*/
|
|
2610
|
-
getProgramId() {
|
|
2611
|
-
return this.programId;
|
|
2612
|
-
}
|
|
2613
|
-
async approveTokens(tokenId, amount) {
|
|
2614
|
-
const tokenContract = new ethers.Contract(tokenId, ercAbi_default, this.signer);
|
|
2615
|
-
const address = await this.signer.getAddress();
|
|
2616
|
-
const allowance = await tokenContract.allowance(address, this.programId);
|
|
2617
|
-
if (new BN7(allowance.toString()).gte(amount)) {
|
|
2618
|
-
return;
|
|
2619
|
-
}
|
|
2620
|
-
const approvalTx = await tokenContract.approve(this.programId, amount.toString());
|
|
2621
|
-
await approvalTx.wait();
|
|
2622
|
-
}
|
|
2623
|
-
// Utility function to prepare transaction payloads for multiple recipients.
|
|
2624
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2625
|
-
async generateMultiPayloads(multipleStreamData) {
|
|
2626
|
-
const sender = await this.signer.getAddress();
|
|
2627
|
-
return multipleStreamData.recipients.map((recipient) => {
|
|
2628
|
-
return [
|
|
2629
|
-
multipleStreamData.tokenId,
|
|
2630
|
-
recipient.amount.toString(),
|
|
2631
|
-
multipleStreamData.period,
|
|
2632
|
-
recipient.amountPerPeriod.toString(),
|
|
2633
|
-
multipleStreamData.start,
|
|
2634
|
-
recipient.cliffAmount.toString(),
|
|
2635
|
-
[
|
|
2636
|
-
multipleStreamData.cancelableBySender,
|
|
2637
|
-
multipleStreamData.cancelableByRecipient,
|
|
2638
|
-
multipleStreamData.transferableBySender,
|
|
2639
|
-
multipleStreamData.transferableByRecipient,
|
|
2640
|
-
multipleStreamData.canTopup,
|
|
2641
|
-
multipleStreamData.canPause || false,
|
|
2642
|
-
multipleStreamData.canUpdateRate || false,
|
|
2643
|
-
multipleStreamData.automaticWithdrawal || false,
|
|
2644
|
-
multipleStreamData.withdrawalFrequency || 0,
|
|
2645
|
-
recipient.name
|
|
2646
|
-
],
|
|
2647
|
-
recipient.recipient,
|
|
2648
|
-
multipleStreamData.partner || sender
|
|
2649
|
-
];
|
|
2650
|
-
});
|
|
2651
|
-
}
|
|
2652
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2653
|
-
getFeeParams(multipleStreamData) {
|
|
2654
|
-
return [
|
|
2655
|
-
multipleStreamData.recipients[0].amount.toString(),
|
|
2656
|
-
multipleStreamData.period,
|
|
2657
|
-
multipleStreamData.recipients[0].amountPerPeriod.toString(),
|
|
2658
|
-
multipleStreamData.start,
|
|
2659
|
-
multipleStreamData.recipients[0].cliffAmount.toString(),
|
|
2660
|
-
multipleStreamData.automaticWithdrawal || false,
|
|
2661
|
-
multipleStreamData.withdrawalFrequency || 0
|
|
2662
|
-
];
|
|
2663
|
-
}
|
|
2664
|
-
formatMetadataId(id) {
|
|
2665
|
-
return toChecksumAddress(`0x${id.slice(-40)}`);
|
|
182
|
+
var AlignedContract = class extends Contract {
|
|
183
|
+
constructor(stream, alignedProxy) {
|
|
184
|
+
super(stream);
|
|
185
|
+
this.minPrice = getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
186
|
+
this.maxPrice = getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
187
|
+
this.minPercentage = getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
188
|
+
this.maxPercentage = getNumberFromBN(alignedProxy.maxPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
189
|
+
this.oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key) || "none";
|
|
190
|
+
this.tickSize = alignedProxy.tickSize.toNumber();
|
|
191
|
+
this.priceOracle = this.oracleType === "none" ? void 0 : alignedProxy.priceOracle.toBase58();
|
|
192
|
+
this.sender = alignedProxy.sender.toBase58();
|
|
193
|
+
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
194
|
+
this.proxyAddress = stream.sender.toBase58();
|
|
195
|
+
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
196
|
+
this.initialPrice = getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
197
|
+
this.lastPrice = getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
198
|
+
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
199
|
+
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
200
|
+
this.expiryTime = alignedProxy.expiryTime.toNumber();
|
|
201
|
+
this.expiryPercentage = getNumberFromBN(alignedProxy.expiryPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
202
|
+
this.floorPrice = getNumberFromBN(alignedProxy.floorPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
203
|
+
this.type = buildStreamType(this);
|
|
204
|
+
this.isAligned = true;
|
|
2666
205
|
}
|
|
2667
206
|
};
|
|
2668
|
-
|
|
2669
|
-
// solana/index.ts
|
|
2670
|
-
var solana_exports = {};
|
|
2671
|
-
__export(solana_exports, {
|
|
2672
|
-
AlignedContract: () => AlignedContract,
|
|
2673
|
-
Contract: () => Contract2,
|
|
2674
|
-
ContractError: () => ContractError,
|
|
2675
|
-
IChain: () => IChain,
|
|
2676
|
-
ICluster: () => ICluster,
|
|
2677
|
-
SolanaStreamClient: () => SolanaStreamClient,
|
|
2678
|
-
cancelStreamInstruction: () => cancelStreamInstruction,
|
|
2679
|
-
constants: () => constants_exports3,
|
|
2680
|
-
createStreamInstruction: () => createStreamInstruction,
|
|
2681
|
-
createUncheckedStreamInstruction: () => createUncheckedStreamInstruction,
|
|
2682
|
-
decodeStream: () => decodeStream,
|
|
2683
|
-
deriveContractPDA: () => deriveContractPDA,
|
|
2684
|
-
deriveEscrowPDA: () => deriveEscrowPDA,
|
|
2685
|
-
deriveTestOraclePDA: () => deriveTestOraclePDA,
|
|
2686
|
-
extractSolanaErrorCode: () => extractSolanaErrorCode,
|
|
2687
|
-
sendAndConfirmStreamRawTransaction: () => sendAndConfirmStreamRawTransaction,
|
|
2688
|
-
signAllTransactionWithRecipients: () => signAllTransactionWithRecipients,
|
|
2689
|
-
timelockIDL: () => timelockIDL_default,
|
|
2690
|
-
topupStreamInstruction: () => topupStreamInstruction,
|
|
2691
|
-
transferStreamInstruction: () => transferStreamInstruction,
|
|
2692
|
-
updateStreamInstruction: () => updateStreamInstruction,
|
|
2693
|
-
withdrawStreamInstruction: () => withdrawStreamInstruction
|
|
2694
|
-
});
|
|
2695
|
-
|
|
2696
|
-
// solana/constants.ts
|
|
2697
|
-
var constants_exports3 = {};
|
|
2698
|
-
__export(constants_exports3, {
|
|
2699
|
-
AIRDROP_AMOUNT: () => AIRDROP_AMOUNT,
|
|
2700
|
-
AIRDROP_TEST_TOKEN: () => AIRDROP_TEST_TOKEN,
|
|
2701
|
-
ALIGNED_COMPUTE_LIMIT: () => ALIGNED_COMPUTE_LIMIT,
|
|
2702
|
-
ALIGNED_PRECISION_FACTOR_POW: () => ALIGNED_PRECISION_FACTOR_POW,
|
|
2703
|
-
ALIGNED_UNLOCKS_PROGRAM_ID: () => ALIGNED_UNLOCKS_PROGRAM_ID,
|
|
2704
|
-
CONTRACT_DISCRIMINATOR: () => CONTRACT_DISCRIMINATOR,
|
|
2705
|
-
CONTRACT_SEED: () => CONTRACT_SEED,
|
|
2706
|
-
CREATE_PARAMS_PADDING: () => CREATE_PARAMS_PADDING,
|
|
2707
|
-
DEFAULT_STREAMFLOW_FEE: () => DEFAULT_STREAMFLOW_FEE,
|
|
2708
|
-
ESCROW_SEED: () => ESCROW_SEED,
|
|
2709
|
-
FEES_METADATA_SEED: () => FEES_METADATA_SEED,
|
|
2710
|
-
FEE_ORACLE_PUBLIC_KEY: () => FEE_ORACLE_PUBLIC_KEY,
|
|
2711
|
-
ORIGINAL_CONTRACT_SENDER_OFFSET: () => ORIGINAL_CONTRACT_SENDER_OFFSET,
|
|
2712
|
-
PARTNERS_SCHEMA: () => PARTNERS_SCHEMA,
|
|
2713
|
-
PARTNER_ORACLE_PROGRAM_ID: () => PARTNER_ORACLE_PROGRAM_ID,
|
|
2714
|
-
PARTNER_SCHEMA: () => PARTNER_SCHEMA,
|
|
2715
|
-
PROGRAM_ID: () => PROGRAM_ID,
|
|
2716
|
-
SOLANA_ERROR_MAP: () => SOLANA_ERROR_MAP,
|
|
2717
|
-
SOLANA_ERROR_MATCH_REGEX: () => SOLANA_ERROR_MATCH_REGEX,
|
|
2718
|
-
STREAMFLOW_TREASURY_PUBLIC_KEY: () => STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
2719
|
-
STREAM_STRUCT_OFFSETS: () => STREAM_STRUCT_OFFSETS,
|
|
2720
|
-
STREAM_STRUCT_OFFSET_CLOSED: () => STREAM_STRUCT_OFFSET_CLOSED,
|
|
2721
|
-
STREAM_STRUCT_OFFSET_MINT: () => STREAM_STRUCT_OFFSET_MINT,
|
|
2722
|
-
STREAM_STRUCT_OFFSET_RECIPIENT: () => STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
2723
|
-
STREAM_STRUCT_OFFSET_SENDER: () => STREAM_STRUCT_OFFSET_SENDER,
|
|
2724
|
-
TEST_ORACLE_DISCRIMINATOR: () => TEST_ORACLE_DISCRIMINATOR,
|
|
2725
|
-
TEST_ORACLE_SEED: () => TEST_ORACLE_SEED,
|
|
2726
|
-
TX_FINALITY_CONFIRMED: () => TX_FINALITY_CONFIRMED,
|
|
2727
|
-
WITHDRAWOR_PUBLIC_KEY: () => WITHDRAWOR_PUBLIC_KEY
|
|
2728
|
-
});
|
|
2729
207
|
var TX_FINALITY_CONFIRMED = "confirmed";
|
|
2730
208
|
var ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
|
|
2731
209
|
var STREAM_STRUCT_OFFSET_SENDER = 49;
|
|
2732
210
|
var STREAM_STRUCT_OFFSET_RECIPIENT = 113;
|
|
2733
211
|
var STREAM_STRUCT_OFFSET_MINT = 177;
|
|
2734
212
|
var STREAM_STRUCT_OFFSET_CLOSED = 671;
|
|
2735
|
-
var
|
|
213
|
+
var MAX_SAFE_UNIX_TIME_VALUE2 = 864e10;
|
|
214
|
+
var WITHDRAW_AVAILABLE_AMOUNT = new BN3("18446744073709551615");
|
|
215
|
+
var ALIGNED_PRECISION_FACTOR_POW2 = 9;
|
|
2736
216
|
var STREAM_STRUCT_OFFSETS = {
|
|
2737
217
|
mint: STREAM_STRUCT_OFFSET_MINT,
|
|
2738
218
|
recipient: STREAM_STRUCT_OFFSET_RECIPIENT,
|
|
@@ -2813,88 +293,8 @@ var SOLANA_ERROR_MAP = {
|
|
|
2813
293
|
6011: "AmountAlreadyUpdated" /* AmountAlreadyUpdated */,
|
|
2814
294
|
6012: "AllFundsUnlocked" /* AllFundsUnlocked */
|
|
2815
295
|
};
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
this.magic = stream.magic.toNumber();
|
|
2819
|
-
this.version = stream.version.toNumber();
|
|
2820
|
-
this.createdAt = stream.createdAt.toNumber();
|
|
2821
|
-
this.withdrawnAmount = stream.withdrawnAmount;
|
|
2822
|
-
this.canceledAt = stream.canceledAt.toNumber();
|
|
2823
|
-
this.end = decodeEndTime(stream.end);
|
|
2824
|
-
this.lastWithdrawnAt = stream.lastWithdrawnAt.toNumber();
|
|
2825
|
-
this.sender = stream.sender.toBase58();
|
|
2826
|
-
this.senderTokens = stream.senderTokens.toBase58();
|
|
2827
|
-
this.recipient = stream.recipient.toBase58();
|
|
2828
|
-
this.recipientTokens = stream.recipientTokens.toBase58();
|
|
2829
|
-
this.mint = stream.mint.toBase58();
|
|
2830
|
-
this.escrowTokens = stream.escrowTokens.toBase58();
|
|
2831
|
-
this.streamflowTreasury = stream.streamflowTreasury.toBase58();
|
|
2832
|
-
this.streamflowTreasuryTokens = stream.streamflowTreasuryTokens.toBase58();
|
|
2833
|
-
this.streamflowFeeTotal = stream.streamflowFeeTotal;
|
|
2834
|
-
this.streamflowFeeWithdrawn = stream.streamflowFeeWithdrawn;
|
|
2835
|
-
this.streamflowFeePercent = stream.streamflowFeePercent;
|
|
2836
|
-
this.partnerFeeTotal = stream.partnerFeeTotal;
|
|
2837
|
-
this.partnerFeeWithdrawn = stream.partnerFeeWithdrawn;
|
|
2838
|
-
this.partnerFeePercent = stream.partnerFeePercent;
|
|
2839
|
-
this.partner = stream.partner.toBase58();
|
|
2840
|
-
this.partnerTokens = stream.partnerTokens?.toBase58();
|
|
2841
|
-
this.start = stream.start.toNumber();
|
|
2842
|
-
this.depositedAmount = stream.depositedAmount;
|
|
2843
|
-
this.period = stream.period.toNumber();
|
|
2844
|
-
this.amountPerPeriod = stream.amountPerPeriod;
|
|
2845
|
-
this.cliff = stream.cliff.toNumber();
|
|
2846
|
-
this.cliffAmount = stream.cliffAmount;
|
|
2847
|
-
this.cancelableBySender = stream.cancelableBySender;
|
|
2848
|
-
this.cancelableByRecipient = stream.cancelableByRecipient;
|
|
2849
|
-
this.automaticWithdrawal = stream.automaticWithdrawal;
|
|
2850
|
-
this.transferableBySender = stream.transferableBySender;
|
|
2851
|
-
this.transferableByRecipient = stream.transferableByRecipient;
|
|
2852
|
-
this.canTopup = stream.canTopup;
|
|
2853
|
-
this.name = stream.name;
|
|
2854
|
-
this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
|
|
2855
|
-
this.closed = stream.closed;
|
|
2856
|
-
this.currentPauseStart = stream.currentPauseStart.toNumber();
|
|
2857
|
-
this.pauseCumulative = stream.pauseCumulative;
|
|
2858
|
-
this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
|
|
2859
|
-
this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
|
|
2860
|
-
this.type = buildStreamType(this);
|
|
2861
|
-
this.isAligned = false;
|
|
2862
|
-
}
|
|
2863
|
-
unlocked(currentTimestamp) {
|
|
2864
|
-
return calculateUnlockedAmount({
|
|
2865
|
-
...this,
|
|
2866
|
-
currentTimestamp
|
|
2867
|
-
});
|
|
2868
|
-
}
|
|
2869
|
-
remaining(decimals) {
|
|
2870
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
2871
|
-
}
|
|
2872
|
-
};
|
|
2873
|
-
var AlignedContract = class extends Contract2 {
|
|
2874
|
-
constructor(stream, alignedProxy) {
|
|
2875
|
-
super(stream);
|
|
2876
|
-
this.minPrice = getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2877
|
-
this.maxPrice = getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2878
|
-
this.minPercentage = getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
2879
|
-
this.maxPercentage = getNumberFromBN(alignedProxy.maxPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
2880
|
-
this.oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key) || "none";
|
|
2881
|
-
this.tickSize = alignedProxy.tickSize.toNumber();
|
|
2882
|
-
this.priceOracle = this.oracleType === "none" ? void 0 : alignedProxy.priceOracle.toBase58();
|
|
2883
|
-
this.sender = alignedProxy.sender.toBase58();
|
|
2884
|
-
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
2885
|
-
this.proxyAddress = stream.sender.toBase58();
|
|
2886
|
-
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
2887
|
-
this.initialPrice = getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2888
|
-
this.lastPrice = getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2889
|
-
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
2890
|
-
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
2891
|
-
this.expiryTime = alignedProxy.expiryTime.toNumber();
|
|
2892
|
-
this.expiryPercentage = getNumberFromBN(alignedProxy.expiryPercentage, ALIGNED_PRECISION_FACTOR_POW);
|
|
2893
|
-
this.floorPrice = getNumberFromBN(alignedProxy.floorPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
2894
|
-
this.type = buildStreamType(this);
|
|
2895
|
-
this.isAligned = true;
|
|
2896
|
-
}
|
|
2897
|
-
};
|
|
296
|
+
|
|
297
|
+
// solana/layout.ts
|
|
2898
298
|
var streamLayout = BufferLayout.struct([
|
|
2899
299
|
BufferLayout.blob(8, "magic"),
|
|
2900
300
|
BufferLayout.blob(1, "version"),
|
|
@@ -3054,20 +454,25 @@ var encodeUpdateStream = (values, data) => {
|
|
|
3054
454
|
var topupStreamLayout = BufferLayout.struct([
|
|
3055
455
|
BufferLayout.blob(8, "amount")
|
|
3056
456
|
]);
|
|
3057
|
-
|
|
3058
|
-
|
|
457
|
+
var FEE_PRECISION = 4;
|
|
458
|
+
var FEE_NORMALIZER = 10 ** FEE_PRECISION;
|
|
459
|
+
var FEE_MULTIPLIER = new BN3(10 ** 6);
|
|
3059
460
|
var decoder = new TextDecoder("utf-8");
|
|
3060
461
|
var LE = "le";
|
|
462
|
+
var calculateTotalAmountToDeposit = (depositedAmount, totalFee) => {
|
|
463
|
+
const totalFeeNormalized = new BN3(totalFee * FEE_NORMALIZER);
|
|
464
|
+
return depositedAmount.mul(totalFeeNormalized.add(FEE_MULTIPLIER)).div(FEE_MULTIPLIER);
|
|
465
|
+
};
|
|
3061
466
|
var decodeStream = (buf) => {
|
|
3062
467
|
const raw = streamLayout.decode(buf);
|
|
3063
468
|
return {
|
|
3064
|
-
magic: new
|
|
3065
|
-
version: new
|
|
3066
|
-
createdAt: new
|
|
3067
|
-
withdrawnAmount: new
|
|
3068
|
-
canceledAt: new
|
|
3069
|
-
end: new
|
|
3070
|
-
lastWithdrawnAt: new
|
|
469
|
+
magic: new BN3(raw.magic, LE),
|
|
470
|
+
version: new BN3(raw.version, LE),
|
|
471
|
+
createdAt: new BN3(raw.created_at, LE),
|
|
472
|
+
withdrawnAmount: new BN3(raw.withdrawn_amount, LE),
|
|
473
|
+
canceledAt: new BN3(raw.canceled_at, LE),
|
|
474
|
+
end: new BN3(raw.end_time, LE),
|
|
475
|
+
lastWithdrawnAt: new BN3(raw.last_withdrawn_at, LE),
|
|
3071
476
|
sender: new PublicKey(raw.sender),
|
|
3072
477
|
senderTokens: new PublicKey(raw.sender_tokens),
|
|
3073
478
|
recipient: new PublicKey(raw.recipient),
|
|
@@ -3076,20 +481,20 @@ var decodeStream = (buf) => {
|
|
|
3076
481
|
escrowTokens: new PublicKey(raw.escrow_tokens),
|
|
3077
482
|
streamflowTreasury: new PublicKey(raw.streamflow_treasury),
|
|
3078
483
|
streamflowTreasuryTokens: new PublicKey(raw.streamflow_treasury_tokens),
|
|
3079
|
-
streamflowFeeTotal: new
|
|
3080
|
-
streamflowFeeWithdrawn: new
|
|
484
|
+
streamflowFeeTotal: new BN3(raw.streamflow_fee_total, LE),
|
|
485
|
+
streamflowFeeWithdrawn: new BN3(raw.streamflow_fee_withdrawn, LE),
|
|
3081
486
|
streamflowFeePercent: raw.streamflow_fee_percent,
|
|
3082
|
-
partnerFeeTotal: new
|
|
3083
|
-
partnerFeeWithdrawn: new
|
|
487
|
+
partnerFeeTotal: new BN3(raw.partner_fee_total, LE),
|
|
488
|
+
partnerFeeWithdrawn: new BN3(raw.partner_fee_withdrawn, LE),
|
|
3084
489
|
partnerFeePercent: raw.partner_fee_percent,
|
|
3085
490
|
partner: new PublicKey(raw.partner),
|
|
3086
491
|
partnerTokens: new PublicKey(raw.partner_tokens),
|
|
3087
|
-
start: new
|
|
3088
|
-
depositedAmount: new
|
|
3089
|
-
period: new
|
|
3090
|
-
amountPerPeriod: new
|
|
3091
|
-
cliff: new
|
|
3092
|
-
cliffAmount: new
|
|
492
|
+
start: new BN3(raw.start_time, LE),
|
|
493
|
+
depositedAmount: new BN3(raw.net_amount_deposited, LE),
|
|
494
|
+
period: new BN3(raw.period, LE),
|
|
495
|
+
amountPerPeriod: new BN3(raw.amount_per_period, LE),
|
|
496
|
+
cliff: new BN3(raw.cliff, LE),
|
|
497
|
+
cliffAmount: new BN3(raw.cliff_amount, LE),
|
|
3093
498
|
cancelableBySender: Boolean(raw.cancelable_by_sender),
|
|
3094
499
|
cancelableByRecipient: Boolean(raw.cancelable_by_recipient),
|
|
3095
500
|
automaticWithdrawal: Boolean(raw.automatic_withdrawal),
|
|
@@ -3097,12 +502,12 @@ var decodeStream = (buf) => {
|
|
|
3097
502
|
transferableByRecipient: Boolean(raw.transferable_by_recipient),
|
|
3098
503
|
canTopup: Boolean(raw.can_topup),
|
|
3099
504
|
name: decoder.decode(raw.stream_name),
|
|
3100
|
-
withdrawFrequency: new
|
|
505
|
+
withdrawFrequency: new BN3(raw.withdraw_frequency, LE),
|
|
3101
506
|
closed: Boolean(raw.closed),
|
|
3102
|
-
currentPauseStart: new
|
|
3103
|
-
pauseCumulative: new
|
|
3104
|
-
lastRateChangeTime: new
|
|
3105
|
-
fundsUnlockedAtLastRateChange: new
|
|
507
|
+
currentPauseStart: new BN3(raw.current_pause_start, LE),
|
|
508
|
+
pauseCumulative: new BN3(raw.pause_cumulative, LE),
|
|
509
|
+
lastRateChangeTime: new BN3(raw.last_rate_change_time, LE),
|
|
510
|
+
fundsUnlockedAtLastRateChange: new BN3(raw.funds_unlocked_at_last_rate_change, LE)
|
|
3106
511
|
};
|
|
3107
512
|
};
|
|
3108
513
|
async function signAllTransactionWithRecipients(sender, items) {
|
|
@@ -3134,6 +539,19 @@ async function sendAndConfirmStreamRawTransaction(connection, batchItem, confirm
|
|
|
3134
539
|
};
|
|
3135
540
|
}
|
|
3136
541
|
}
|
|
542
|
+
async function handleContractError(func, callback) {
|
|
543
|
+
try {
|
|
544
|
+
return await func();
|
|
545
|
+
} catch (err) {
|
|
546
|
+
if (err instanceof Error) {
|
|
547
|
+
if (callback) {
|
|
548
|
+
throw new ContractError(err, callback(err));
|
|
549
|
+
}
|
|
550
|
+
throw new ContractError(err);
|
|
551
|
+
}
|
|
552
|
+
throw err;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
3137
555
|
function extractSolanaErrorCode(errorText, logs) {
|
|
3138
556
|
let match = SOLANA_ERROR_MATCH_REGEX.exec(errorText);
|
|
3139
557
|
if (!match && logs) {
|
|
@@ -4976,12 +2394,11 @@ var deriveTestOraclePDA = (programId, mint, creator) => {
|
|
|
4976
2394
|
// solana/StreamClient.ts
|
|
4977
2395
|
var METADATA_ACC_SIZE = 1104;
|
|
4978
2396
|
var ALIGNED_METADATA_ACC_SIZE = 320;
|
|
4979
|
-
var SolanaStreamClient = class
|
|
2397
|
+
var SolanaStreamClient = class {
|
|
4980
2398
|
/**
|
|
4981
2399
|
* Create Stream instance
|
|
4982
2400
|
*/
|
|
4983
2401
|
constructor(optionsOrClusterUrl, cluster = ICluster.Mainnet, commitment = "confirmed", programId = "", sendRate = 1, sendThrottler) {
|
|
4984
|
-
super();
|
|
4985
2402
|
if (typeof optionsOrClusterUrl === "string") {
|
|
4986
2403
|
this.commitment = commitment;
|
|
4987
2404
|
this.connection = new Connection(optionsOrClusterUrl, this.commitment);
|
|
@@ -5033,7 +2450,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5033
2450
|
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
5034
2451
|
*
|
|
5035
2452
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5036
|
-
* @param {Omit<
|
|
2453
|
+
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5037
2454
|
* @returns Transaction instructions and metadata ID
|
|
5038
2455
|
*/
|
|
5039
2456
|
async buildCreateTransactionInstructions(data, extParams) {
|
|
@@ -5080,7 +2497,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5080
2497
|
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
5081
2498
|
*
|
|
5082
2499
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5083
|
-
* @param {Omit<
|
|
2500
|
+
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5084
2501
|
* @returns Transaction and metadata information
|
|
5085
2502
|
*/
|
|
5086
2503
|
async buildCreateTransaction(data, extParams) {
|
|
@@ -5101,7 +2518,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5101
2518
|
* Creates a new stream/vesting contract.
|
|
5102
2519
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5103
2520
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5104
|
-
* @param {
|
|
2521
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, native token handling, and compute settings
|
|
5105
2522
|
* @returns Create result
|
|
5106
2523
|
*/
|
|
5107
2524
|
async create(data, extParams) {
|
|
@@ -5189,11 +2606,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5189
2606
|
const encodedUIntArray = new TextEncoder().encode(streamName);
|
|
5190
2607
|
const streamNameArray = Array.from(encodedUIntArray);
|
|
5191
2608
|
const createIx = await this.alignedProxyProgram.methods.create({
|
|
5192
|
-
startTime: new
|
|
2609
|
+
startTime: new BN3(start),
|
|
5193
2610
|
netAmountDeposited: depositedAmount,
|
|
5194
|
-
period: new
|
|
2611
|
+
period: new BN3(period),
|
|
5195
2612
|
amountPerPeriod,
|
|
5196
|
-
cliff: new
|
|
2613
|
+
cliff: new BN3(cliff),
|
|
5197
2614
|
cliffAmount,
|
|
5198
2615
|
transferableBySender,
|
|
5199
2616
|
transferableByRecipient,
|
|
@@ -5202,15 +2619,15 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5202
2619
|
canTopup,
|
|
5203
2620
|
oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
|
|
5204
2621
|
streamName: streamNameArray,
|
|
5205
|
-
minPrice: typeof minPrice === "number" ? getBN
|
|
5206
|
-
maxPrice: typeof maxPrice === "number" ? getBN
|
|
5207
|
-
minPercentage: typeof minPercentage === "number" ? getBN
|
|
5208
|
-
maxPercentage: typeof maxPercentage === "number" ? getBN
|
|
5209
|
-
tickSize: new
|
|
2622
|
+
minPrice: typeof minPrice === "number" ? getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW2) : minPrice,
|
|
2623
|
+
maxPrice: typeof maxPrice === "number" ? getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW2) : maxPrice,
|
|
2624
|
+
minPercentage: typeof minPercentage === "number" ? getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW2) : minPercentage,
|
|
2625
|
+
maxPercentage: typeof maxPercentage === "number" ? getBN(maxPercentage, ALIGNED_PRECISION_FACTOR_POW2) : maxPercentage,
|
|
2626
|
+
tickSize: new BN3(tickSize || 1),
|
|
5210
2627
|
skipInitial: skipInitial ?? false,
|
|
5211
|
-
expiryTime: new
|
|
5212
|
-
expiryPercentage: typeof expiryPercentage === "number" ? getBN
|
|
5213
|
-
floorPrice: typeof floorPrice === "number" ? getBN
|
|
2628
|
+
expiryTime: new BN3(expiryTime ?? 0),
|
|
2629
|
+
expiryPercentage: typeof expiryPercentage === "number" ? getBN(expiryPercentage, ALIGNED_PRECISION_FACTOR_POW2) : expiryPercentage ?? new BN3(0),
|
|
2630
|
+
floorPrice: typeof floorPrice === "number" ? getBN(floorPrice, ALIGNED_PRECISION_FACTOR_POW2) : floorPrice ?? new BN3(0)
|
|
5214
2631
|
}).accountsPartial({
|
|
5215
2632
|
payer: sender.publicKey,
|
|
5216
2633
|
sender: sender.publicKey,
|
|
@@ -5232,7 +2649,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5232
2649
|
* Creates a new stream/vesting contract.
|
|
5233
2650
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5234
2651
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5235
|
-
* @param {
|
|
2652
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5236
2653
|
* @returns Create stream instructions
|
|
5237
2654
|
*/
|
|
5238
2655
|
async prepareCreateStreamInstructions({
|
|
@@ -5281,12 +2698,12 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5281
2698
|
ixs.push(
|
|
5282
2699
|
await createStreamInstruction(
|
|
5283
2700
|
{
|
|
5284
|
-
start: new
|
|
2701
|
+
start: new BN3(start),
|
|
5285
2702
|
depositedAmount,
|
|
5286
|
-
period: new
|
|
2703
|
+
period: new BN3(period),
|
|
5287
2704
|
amountPerPeriod,
|
|
5288
|
-
cliff: new
|
|
5289
|
-
cliffAmount: new
|
|
2705
|
+
cliff: new BN3(cliff),
|
|
2706
|
+
cliffAmount: new BN3(cliffAmount),
|
|
5290
2707
|
cancelableBySender,
|
|
5291
2708
|
cancelableByRecipient,
|
|
5292
2709
|
automaticWithdrawal,
|
|
@@ -5296,7 +2713,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5296
2713
|
canUpdateRate: !!canUpdateRate,
|
|
5297
2714
|
canPause: !!canPause,
|
|
5298
2715
|
name,
|
|
5299
|
-
withdrawFrequency: new
|
|
2716
|
+
withdrawFrequency: new BN3(automaticWithdrawal ? withdrawalFrequency : period)
|
|
5300
2717
|
},
|
|
5301
2718
|
this.programId,
|
|
5302
2719
|
{
|
|
@@ -5333,7 +2750,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5333
2750
|
*
|
|
5334
2751
|
* If you are not sure if you should use create or create_unchecked, go for create to be safer.
|
|
5335
2752
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5336
|
-
* @param {
|
|
2753
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5337
2754
|
* @returns Create result
|
|
5338
2755
|
*/
|
|
5339
2756
|
async createUnchecked(data, extParams) {
|
|
@@ -5415,12 +2832,12 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5415
2832
|
}
|
|
5416
2833
|
const createInstruction = await createUncheckedStreamInstruction(
|
|
5417
2834
|
{
|
|
5418
|
-
start: new
|
|
2835
|
+
start: new BN3(start),
|
|
5419
2836
|
depositedAmount,
|
|
5420
|
-
period: new
|
|
2837
|
+
period: new BN3(period),
|
|
5421
2838
|
amountPerPeriod,
|
|
5422
|
-
cliff: new
|
|
5423
|
-
cliffAmount: new
|
|
2839
|
+
cliff: new BN3(cliff),
|
|
2840
|
+
cliffAmount: new BN3(cliffAmount),
|
|
5424
2841
|
cancelableBySender,
|
|
5425
2842
|
cancelableByRecipient,
|
|
5426
2843
|
automaticWithdrawal,
|
|
@@ -5430,7 +2847,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5430
2847
|
canUpdateRate: !!canUpdateRate,
|
|
5431
2848
|
canPause: !!canPause,
|
|
5432
2849
|
name,
|
|
5433
|
-
withdrawFrequency: new
|
|
2850
|
+
withdrawFrequency: new BN3(automaticWithdrawal ? withdrawalFrequency : period),
|
|
5434
2851
|
recipient: recipientPublicKey,
|
|
5435
2852
|
partner: partnerPublicKey
|
|
5436
2853
|
},
|
|
@@ -5456,7 +2873,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5456
2873
|
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
5457
2874
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5458
2875
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5459
|
-
* @param {
|
|
2876
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5460
2877
|
* @returns Create multiple transaction instructions
|
|
5461
2878
|
*/
|
|
5462
2879
|
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
@@ -5499,7 +2916,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5499
2916
|
true
|
|
5500
2917
|
);
|
|
5501
2918
|
if (isNative) {
|
|
5502
|
-
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new
|
|
2919
|
+
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN3(0));
|
|
5503
2920
|
const nativeInstructions = await prepareWrappedAccount(
|
|
5504
2921
|
this.connection,
|
|
5505
2922
|
sender.publicKey,
|
|
@@ -5537,7 +2954,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5537
2954
|
* ```
|
|
5538
2955
|
*
|
|
5539
2956
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5540
|
-
* @param {
|
|
2957
|
+
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5541
2958
|
* @returns Multiple transaction information
|
|
5542
2959
|
*/
|
|
5543
2960
|
async buildCreateMultipleTransactions(data, extParams) {
|
|
@@ -5565,7 +2982,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5565
2982
|
* Creates multiple stream/vesting contracts.
|
|
5566
2983
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5567
2984
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5568
|
-
* @param {
|
|
2985
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5569
2986
|
* @returns Multiple transaction information
|
|
5570
2987
|
*/
|
|
5571
2988
|
async createMultiple(data, extParams) {
|
|
@@ -5630,7 +3047,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5630
3047
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5631
3048
|
* In most cases, createMultiple should be used instead.
|
|
5632
3049
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5633
|
-
* @param {
|
|
3050
|
+
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5634
3051
|
* @returns Multiple transaction information
|
|
5635
3052
|
*/
|
|
5636
3053
|
async createMultipleSequential(data, extParams) {
|
|
@@ -5696,7 +3113,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5696
3113
|
/**
|
|
5697
3114
|
* Attempts withdrawing from the specified stream.
|
|
5698
3115
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
5699
|
-
* @param {
|
|
3116
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5700
3117
|
* @returns Transaction result
|
|
5701
3118
|
*/
|
|
5702
3119
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
@@ -5725,7 +3142,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5725
3142
|
/**
|
|
5726
3143
|
* Creates Transaction Instructions for withdrawal
|
|
5727
3144
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
5728
|
-
* @param {
|
|
3145
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5729
3146
|
* @returns Transaction instructions
|
|
5730
3147
|
*/
|
|
5731
3148
|
async prepareWithdrawInstructions({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
@@ -5770,7 +3187,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5770
3187
|
/**
|
|
5771
3188
|
* Attempts canceling the specified stream.
|
|
5772
3189
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5773
|
-
* @param {
|
|
3190
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5774
3191
|
* @returns Transaction result
|
|
5775
3192
|
*/
|
|
5776
3193
|
async cancel(cancelData, extParams) {
|
|
@@ -5792,7 +3209,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5792
3209
|
/**
|
|
5793
3210
|
* Creates Transaction Instructions for cancel
|
|
5794
3211
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5795
|
-
* @param {
|
|
3212
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5796
3213
|
* @returns Transaction instructions
|
|
5797
3214
|
*/
|
|
5798
3215
|
async prepareCancelInstructions(cancelData, extParams) {
|
|
@@ -5809,7 +3226,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5809
3226
|
/**
|
|
5810
3227
|
* Creates Transaction Instructions for cancel
|
|
5811
3228
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5812
|
-
* @param {
|
|
3229
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5813
3230
|
* @returns Transaction instructions
|
|
5814
3231
|
*/
|
|
5815
3232
|
async prepareCancelAlignedUnlockInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
@@ -5848,7 +3265,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5848
3265
|
/**
|
|
5849
3266
|
* Creates Transaction Instructions for cancel
|
|
5850
3267
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5851
|
-
* @param {
|
|
3268
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5852
3269
|
* @returns Transaction instructions
|
|
5853
3270
|
*/
|
|
5854
3271
|
async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
@@ -5896,7 +3313,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5896
3313
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
5897
3314
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
5898
3315
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
5899
|
-
* @param {
|
|
3316
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
5900
3317
|
* @returns Transaction result
|
|
5901
3318
|
*/
|
|
5902
3319
|
async transfer({ id, newRecipient }, extParams) {
|
|
@@ -5919,7 +3336,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5919
3336
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
5920
3337
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
5921
3338
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
5922
|
-
* @param {
|
|
3339
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
5923
3340
|
* @returns Transaction instructions
|
|
5924
3341
|
*/
|
|
5925
3342
|
async prepareTransferInstructions({ id, newRecipient }, { invoker, computePrice, computeLimit = 100001 }) {
|
|
@@ -5953,7 +3370,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5953
3370
|
/**
|
|
5954
3371
|
* Tops up stream account with specified amount.
|
|
5955
3372
|
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
5956
|
-
* @param {
|
|
3373
|
+
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
5957
3374
|
* @returns Transaction result
|
|
5958
3375
|
*/
|
|
5959
3376
|
async topup({ id, amount }, extParams) {
|
|
@@ -5975,7 +3392,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5975
3392
|
/**
|
|
5976
3393
|
* Create Transaction instructions for topup
|
|
5977
3394
|
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
5978
|
-
* @param {
|
|
3395
|
+
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
5979
3396
|
* @returns Transaction instructions
|
|
5980
3397
|
*/
|
|
5981
3398
|
async prepareTopupInstructions({ id, amount }, { invoker, isNative, computePrice, computeLimit }) {
|
|
@@ -6037,7 +3454,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6037
3454
|
}
|
|
6038
3455
|
return new AlignedContract(stream, alignedProxy);
|
|
6039
3456
|
}
|
|
6040
|
-
return new
|
|
3457
|
+
return new Contract(stream);
|
|
6041
3458
|
}
|
|
6042
3459
|
/**
|
|
6043
3460
|
* Fetch all aligned outgoing streams/contracts by the provided public key.
|
|
@@ -6107,7 +3524,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6107
3524
|
this.programId
|
|
6108
3525
|
);
|
|
6109
3526
|
outgoingStreamAccounts.forEach((account) => {
|
|
6110
|
-
streams[account.pubkey.toBase58()] = new
|
|
3527
|
+
streams[account.pubkey.toBase58()] = new Contract(decodeStream(account.account.data));
|
|
6111
3528
|
});
|
|
6112
3529
|
if (shouldFetchAligned) {
|
|
6113
3530
|
const alignedStreams = await this.getOutgoingAlignedStreams(address);
|
|
@@ -6127,7 +3544,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6127
3544
|
if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender)) {
|
|
6128
3545
|
alignedDecoded[account.pubkey.toBase58()] = allIncomingStreams[index];
|
|
6129
3546
|
} else {
|
|
6130
|
-
streams[account.pubkey.toBase58()] = new
|
|
3547
|
+
streams[account.pubkey.toBase58()] = new Contract(allIncomingStreams[index]);
|
|
6131
3548
|
}
|
|
6132
3549
|
});
|
|
6133
3550
|
if (shouldFetchAligned) {
|
|
@@ -6157,13 +3574,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6157
3574
|
});
|
|
6158
3575
|
return accounts.map(({ pubkey, account }) => ({
|
|
6159
3576
|
publicKey: pubkey,
|
|
6160
|
-
account: new
|
|
3577
|
+
account: new Contract(decodeStream(account.data))
|
|
6161
3578
|
}));
|
|
6162
3579
|
}
|
|
6163
3580
|
/**
|
|
6164
3581
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
6165
3582
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
6166
|
-
* @param {
|
|
3583
|
+
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
6167
3584
|
* @returns Transaction result
|
|
6168
3585
|
*/
|
|
6169
3586
|
async update(data, extParams) {
|
|
@@ -6191,7 +3608,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6191
3608
|
/**
|
|
6192
3609
|
* Create Transaction instructions for update
|
|
6193
3610
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
6194
|
-
* @param {
|
|
3611
|
+
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
6195
3612
|
* @returns Transaction instructions
|
|
6196
3613
|
*/
|
|
6197
3614
|
async prepareUpdateInstructions(data, { invoker, computePrice, computeLimit }) {
|
|
@@ -6244,6 +3661,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6244
3661
|
async getDefaultStreamflowFee() {
|
|
6245
3662
|
return DEFAULT_STREAMFLOW_FEE;
|
|
6246
3663
|
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Returns total fee percent, streamflow fees + partner fees
|
|
3666
|
+
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
3667
|
+
* @param chainSpecificParams additional parameters required by chain client
|
|
3668
|
+
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
3669
|
+
*/
|
|
3670
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3671
|
+
async getTotalFee(getFeesData) {
|
|
3672
|
+
const fees = await this.getFees(getFeesData);
|
|
3673
|
+
if (fees) {
|
|
3674
|
+
return fees.partnerFee + fees.streamflowFee;
|
|
3675
|
+
}
|
|
3676
|
+
return this.getDefaultStreamflowFee();
|
|
3677
|
+
}
|
|
6247
3678
|
/**
|
|
6248
3679
|
* Extracts error code from an error
|
|
6249
3680
|
* @param {Error} err - Error
|
|
@@ -6719,815 +4150,6 @@ var timelockIDL_default = {
|
|
|
6719
4150
|
]
|
|
6720
4151
|
};
|
|
6721
4152
|
|
|
6722
|
-
|
|
6723
|
-
var sui_exports = {};
|
|
6724
|
-
__export(sui_exports, {
|
|
6725
|
-
Contract: () => Contract3,
|
|
6726
|
-
SuiStreamClient: () => SuiStreamClient,
|
|
6727
|
-
constants: () => constants_exports4,
|
|
6728
|
-
extractSuiErrorInfo: () => extractSuiErrorInfo,
|
|
6729
|
-
getTransactionBlock: () => getTransactionBlock
|
|
6730
|
-
});
|
|
6731
|
-
|
|
6732
|
-
// sui/constants.ts
|
|
6733
|
-
var constants_exports4 = {};
|
|
6734
|
-
__export(constants_exports4, {
|
|
6735
|
-
SUI_CONFIG_IDS: () => SUI_CONFIG_IDS,
|
|
6736
|
-
SUI_ERROR_MATCH_REGEX: () => SUI_ERROR_MATCH_REGEX,
|
|
6737
|
-
SUI_FEE_TABLE_IDS: () => SUI_FEE_TABLE_IDS,
|
|
6738
|
-
SUI_MODULE_ERROR_MAP: () => SUI_MODULE_ERROR_MAP,
|
|
6739
|
-
SUI_PROGRAM_IDS: () => SUI_PROGRAM_IDS
|
|
6740
|
-
});
|
|
6741
|
-
var SUI_PROGRAM_IDS = {
|
|
6742
|
-
[ICluster.Mainnet]: "0xe456a3a1d4e58e85b4b7175fabe6dae895b983f1379bb8948d6ec2f137b08a7b",
|
|
6743
|
-
[ICluster.Devnet]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
6744
|
-
[ICluster.Testnet]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a",
|
|
6745
|
-
[ICluster.Local]: "0x34dacd839e1758ebb70bdcd4e08f18fbfef5e2b96d9aa7ce2b4a71d96ca0df5a"
|
|
6746
|
-
};
|
|
6747
|
-
var SUI_CONFIG_IDS = {
|
|
6748
|
-
[ICluster.Mainnet]: "0x6cf6760b64245b8d23ef57c28ddceb6adbd540a23a509fef29b82237da4ab87b",
|
|
6749
|
-
[ICluster.Devnet]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
6750
|
-
[ICluster.Testnet]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8",
|
|
6751
|
-
[ICluster.Local]: "0xd6c9f5074584f58074ce56e3c5cc436d82258ec3285f186a0d6438a60bacdbf8"
|
|
6752
|
-
};
|
|
6753
|
-
var SUI_FEE_TABLE_IDS = {
|
|
6754
|
-
[ICluster.Mainnet]: "0xad9b75399632583fb9fcae6b5bcca34e6542ab3bedb630ecbd3f15cb1cc48dbe",
|
|
6755
|
-
[ICluster.Devnet]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
6756
|
-
[ICluster.Testnet]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078",
|
|
6757
|
-
[ICluster.Local]: "0x6057b093904c5bdfec1067d2b8a4dc35f65bcab03b3029ad716c4882b0f36078"
|
|
6758
|
-
};
|
|
6759
|
-
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+)/;
|
|
6760
|
-
var SUI_MODULE_ERROR_MAP = {
|
|
6761
|
-
protocol: {
|
|
6762
|
-
1: "ECONTRACT_NOT_INIT" /* ECONTRACT_NOT_INIT */,
|
|
6763
|
-
2: "EBAD_AMOUNT" /* EBAD_AMOUNT */,
|
|
6764
|
-
3: "ENO_PERMISSIONS" /* ENO_PERMISSIONS */,
|
|
6765
|
-
4: "EBADINPUT" /* EBADINPUT */,
|
|
6766
|
-
5: "ECLOSED" /* ECLOSED */,
|
|
6767
|
-
6: "EBAD_INPUT_AMOUNT_PER_PERIOD" /* EBAD_INPUT_AMOUNT_PER_PERIOD */,
|
|
6768
|
-
8: "EBAD_INPUT_UPDATE_RATE" /* EBAD_INPUT_UPDATE_RATE */,
|
|
6769
|
-
9: "EBAD_INPUT_CLIFF_AMOUNT" /* EBAD_INPUT_CLIFF_AMOUNT */,
|
|
6770
|
-
10: "EBAD_INPUT_PERIOD" /* EBAD_INPUT_PERIOD */,
|
|
6771
|
-
11: "EBAD_INPUT_START" /* EBAD_INPUT_START */,
|
|
6772
|
-
13: "EBAD_INSUFFICIENT_WITHDRAWAL_FEES" /* EBAD_INSUFFICIENT_WITHDRAWAL_FEES */,
|
|
6773
|
-
14: "EBAD_INSUFFICIENT_AMOUNT" /* EBAD_INSUFFICIENT_AMOUNT */,
|
|
6774
|
-
15: "EPAUSED" /* EPAUSED */,
|
|
6775
|
-
16: "ENOTPAUSED" /* ENOTPAUSED */
|
|
6776
|
-
}
|
|
6777
|
-
};
|
|
6778
|
-
var Contract3 = class {
|
|
6779
|
-
constructor(stream, tokenId) {
|
|
6780
|
-
const meta = stream.meta.fields;
|
|
6781
|
-
const fees = stream.fees.fields;
|
|
6782
|
-
this.magic = 0;
|
|
6783
|
-
this.version = parseInt(stream.version);
|
|
6784
|
-
this.createdAt = parseInt(stream.created);
|
|
6785
|
-
this.withdrawnAmount = new BN7(stream.withdrawn);
|
|
6786
|
-
this.canceledAt = parseInt(stream.canceled_at);
|
|
6787
|
-
this.end = parseInt(stream.end);
|
|
6788
|
-
this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
|
|
6789
|
-
this.sender = stream.sender;
|
|
6790
|
-
this.senderTokens = stream.sender;
|
|
6791
|
-
this.recipient = stream.recipient;
|
|
6792
|
-
this.recipientTokens = stream.recipient;
|
|
6793
|
-
this.mint = tokenId;
|
|
6794
|
-
this.escrowTokens = "";
|
|
6795
|
-
this.streamflowTreasury = "";
|
|
6796
|
-
this.streamflowTreasuryTokens = "";
|
|
6797
|
-
this.streamflowFeeTotal = new BN7(0);
|
|
6798
|
-
this.streamflowFeeWithdrawn = new BN7(0);
|
|
6799
|
-
this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 1e4;
|
|
6800
|
-
this.partnerFeeTotal = new BN7(0);
|
|
6801
|
-
this.partnerFeeWithdrawn = new BN7(0);
|
|
6802
|
-
this.partnerFeePercent = parseInt(fees.partner_fee_percentage) / 1e4;
|
|
6803
|
-
this.partner = stream.partner;
|
|
6804
|
-
this.partnerTokens = "";
|
|
6805
|
-
this.start = parseInt(stream.start);
|
|
6806
|
-
this.depositedAmount = new BN7(stream.amount);
|
|
6807
|
-
this.period = parseInt(stream.period);
|
|
6808
|
-
this.amountPerPeriod = new BN7(stream.amount_per_period);
|
|
6809
|
-
this.cliff = parseInt(stream.start);
|
|
6810
|
-
this.cliffAmount = new BN7(stream.cliff_amount);
|
|
6811
|
-
this.cancelableBySender = meta.cancelable_by_sender;
|
|
6812
|
-
this.cancelableByRecipient = meta.cancelable_by_recipient;
|
|
6813
|
-
this.automaticWithdrawal = meta.automatic_withdrawal;
|
|
6814
|
-
this.transferableBySender = meta.transferable_by_sender;
|
|
6815
|
-
this.transferableByRecipient = meta.transferable_by_recipient;
|
|
6816
|
-
this.canTopup = meta.can_topup;
|
|
6817
|
-
this.name = String.fromCharCode(...meta.contract_name);
|
|
6818
|
-
this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
|
|
6819
|
-
this.closed = stream.closed;
|
|
6820
|
-
this.currentPauseStart = parseInt(stream.current_pause_start);
|
|
6821
|
-
this.pauseCumulative = new BN7(stream.pause_cumulative);
|
|
6822
|
-
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
6823
|
-
this.fundsUnlockedAtLastRateChange = new BN7(stream.funds_unlocked_at_last_rate_change);
|
|
6824
|
-
this.type = buildStreamType(this);
|
|
6825
|
-
}
|
|
6826
|
-
unlocked(currentTimestamp) {
|
|
6827
|
-
return calculateUnlockedAmount({
|
|
6828
|
-
...this,
|
|
6829
|
-
currentTimestamp
|
|
6830
|
-
});
|
|
6831
|
-
}
|
|
6832
|
-
remaining(decimals) {
|
|
6833
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
6834
|
-
}
|
|
6835
|
-
};
|
|
6836
|
-
|
|
6837
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
6838
|
-
var import_retry = __toESM(require_retry2());
|
|
6839
|
-
|
|
6840
|
-
// ../../node_modules/.pnpm/is-network-error@1.1.0/node_modules/is-network-error/index.js
|
|
6841
|
-
var objectToString = Object.prototype.toString;
|
|
6842
|
-
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
6843
|
-
var errorMessages = /* @__PURE__ */ new Set([
|
|
6844
|
-
"network error",
|
|
6845
|
-
// Chrome
|
|
6846
|
-
"Failed to fetch",
|
|
6847
|
-
// Chrome
|
|
6848
|
-
"NetworkError when attempting to fetch resource.",
|
|
6849
|
-
// Firefox
|
|
6850
|
-
"The Internet connection appears to be offline.",
|
|
6851
|
-
// Safari 16
|
|
6852
|
-
"Load failed",
|
|
6853
|
-
// Safari 17+
|
|
6854
|
-
"Network request failed",
|
|
6855
|
-
// `cross-fetch`
|
|
6856
|
-
"fetch failed",
|
|
6857
|
-
// Undici (Node.js)
|
|
6858
|
-
"terminated"
|
|
6859
|
-
// Undici (Node.js)
|
|
6860
|
-
]);
|
|
6861
|
-
function isNetworkError(error) {
|
|
6862
|
-
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
6863
|
-
if (!isValid) {
|
|
6864
|
-
return false;
|
|
6865
|
-
}
|
|
6866
|
-
if (error.message === "Load failed") {
|
|
6867
|
-
return error.stack === void 0;
|
|
6868
|
-
}
|
|
6869
|
-
return errorMessages.has(error.message);
|
|
6870
|
-
}
|
|
6871
|
-
|
|
6872
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
6873
|
-
var AbortError = class extends Error {
|
|
6874
|
-
constructor(message) {
|
|
6875
|
-
super();
|
|
6876
|
-
if (message instanceof Error) {
|
|
6877
|
-
this.originalError = message;
|
|
6878
|
-
({ message } = message);
|
|
6879
|
-
} else {
|
|
6880
|
-
this.originalError = new Error(message);
|
|
6881
|
-
this.originalError.stack = this.stack;
|
|
6882
|
-
}
|
|
6883
|
-
this.name = "AbortError";
|
|
6884
|
-
this.message = message;
|
|
6885
|
-
}
|
|
6886
|
-
};
|
|
6887
|
-
var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
6888
|
-
const retriesLeft = options.retries - (attemptNumber - 1);
|
|
6889
|
-
error.attemptNumber = attemptNumber;
|
|
6890
|
-
error.retriesLeft = retriesLeft;
|
|
6891
|
-
return error;
|
|
6892
|
-
};
|
|
6893
|
-
async function pRetry(input, options) {
|
|
6894
|
-
return new Promise((resolve, reject) => {
|
|
6895
|
-
options = { ...options };
|
|
6896
|
-
options.onFailedAttempt ?? (options.onFailedAttempt = () => {
|
|
6897
|
-
});
|
|
6898
|
-
options.shouldRetry ?? (options.shouldRetry = () => true);
|
|
6899
|
-
options.retries ?? (options.retries = 10);
|
|
6900
|
-
const operation = import_retry.default.operation(options);
|
|
6901
|
-
const abortHandler = () => {
|
|
6902
|
-
operation.stop();
|
|
6903
|
-
reject(options.signal?.reason);
|
|
6904
|
-
};
|
|
6905
|
-
if (options.signal && !options.signal.aborted) {
|
|
6906
|
-
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
6907
|
-
}
|
|
6908
|
-
const cleanUp = () => {
|
|
6909
|
-
options.signal?.removeEventListener("abort", abortHandler);
|
|
6910
|
-
operation.stop();
|
|
6911
|
-
};
|
|
6912
|
-
operation.attempt(async (attemptNumber) => {
|
|
6913
|
-
try {
|
|
6914
|
-
const result = await input(attemptNumber);
|
|
6915
|
-
cleanUp();
|
|
6916
|
-
resolve(result);
|
|
6917
|
-
} catch (error) {
|
|
6918
|
-
try {
|
|
6919
|
-
if (!(error instanceof Error)) {
|
|
6920
|
-
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
6921
|
-
}
|
|
6922
|
-
if (error instanceof AbortError) {
|
|
6923
|
-
throw error.originalError;
|
|
6924
|
-
}
|
|
6925
|
-
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
6926
|
-
throw error;
|
|
6927
|
-
}
|
|
6928
|
-
decorateErrorWithCounts(error, attemptNumber, options);
|
|
6929
|
-
if (!await options.shouldRetry(error)) {
|
|
6930
|
-
operation.stop();
|
|
6931
|
-
reject(error);
|
|
6932
|
-
}
|
|
6933
|
-
await options.onFailedAttempt(error);
|
|
6934
|
-
if (!operation.retry(error)) {
|
|
6935
|
-
throw operation.mainError();
|
|
6936
|
-
}
|
|
6937
|
-
} catch (finalError) {
|
|
6938
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
6939
|
-
cleanUp();
|
|
6940
|
-
reject(finalError);
|
|
6941
|
-
}
|
|
6942
|
-
}
|
|
6943
|
-
});
|
|
6944
|
-
});
|
|
6945
|
-
}
|
|
6946
|
-
|
|
6947
|
-
// sui/utils.ts
|
|
6948
|
-
function extractSuiErrorInfo(errorText) {
|
|
6949
|
-
const error = { text: errorText };
|
|
6950
|
-
const match = SUI_ERROR_MATCH_REGEX.exec(errorText);
|
|
6951
|
-
if (!match) {
|
|
6952
|
-
return error;
|
|
6953
|
-
}
|
|
6954
|
-
const moduleName = match[2];
|
|
6955
|
-
const errorCode = Number(match[4]);
|
|
6956
|
-
const errorName = SUI_MODULE_ERROR_MAP[moduleName] ? SUI_MODULE_ERROR_MAP[moduleName][errorCode] : void 0;
|
|
6957
|
-
const index = Number(match[5]);
|
|
6958
|
-
if (index) {
|
|
6959
|
-
error.index = index;
|
|
6960
|
-
}
|
|
6961
|
-
if (errorName) {
|
|
6962
|
-
error.parsed = {
|
|
6963
|
-
module: moduleName,
|
|
6964
|
-
code: errorCode,
|
|
6965
|
-
name: errorName
|
|
6966
|
-
};
|
|
6967
|
-
}
|
|
6968
|
-
return error;
|
|
6969
|
-
}
|
|
6970
|
-
function getTransactionBlock(client, input) {
|
|
6971
|
-
return pRetry(() => client.getTransactionBlock(input), {
|
|
6972
|
-
retries: 5,
|
|
6973
|
-
shouldRetry: (error) => error.message.includes("Could not find the referenced transaction"),
|
|
6974
|
-
minTimeout: 500,
|
|
6975
|
-
maxTimeout: 1e3
|
|
6976
|
-
});
|
|
6977
|
-
}
|
|
6978
|
-
function isSignerKeypair2(walletOrKeypair) {
|
|
6979
|
-
return walletOrKeypair instanceof Keypair$1 || walletOrKeypair.constructor === Keypair$1 || walletOrKeypair.constructor.name === Keypair$1.prototype.constructor.name || "getSecretKey" in walletOrKeypair;
|
|
6980
|
-
}
|
|
6981
|
-
var SuiWalletWrapper = class {
|
|
6982
|
-
constructor(wallet, client) {
|
|
6983
|
-
this.client = client;
|
|
6984
|
-
this.wallet = wallet;
|
|
6985
|
-
if (isSignerKeypair2(wallet)) {
|
|
6986
|
-
this.address = wallet.toSuiAddress();
|
|
6987
|
-
} else {
|
|
6988
|
-
this.address = wallet.address;
|
|
6989
|
-
}
|
|
6990
|
-
}
|
|
6991
|
-
async signAndExecuteTransaction(input) {
|
|
6992
|
-
if (isSignerKeypair2(this.wallet)) {
|
|
6993
|
-
return this.client.signAndExecuteTransaction({
|
|
6994
|
-
...input,
|
|
6995
|
-
// @ts-ignore
|
|
6996
|
-
signer: this.wallet
|
|
6997
|
-
});
|
|
6998
|
-
}
|
|
6999
|
-
return this.wallet.signAndExecuteTransaction(input);
|
|
7000
|
-
}
|
|
7001
|
-
};
|
|
7002
|
-
|
|
7003
|
-
// sui/StreamClient.ts
|
|
7004
|
-
var SuiStreamClient = class extends BaseStreamClient {
|
|
7005
|
-
constructor(clusterUrl, cluster = ICluster.Mainnet, ids) {
|
|
7006
|
-
super();
|
|
7007
|
-
this.programId = ids?.program ? ids.program : SUI_PROGRAM_IDS[cluster];
|
|
7008
|
-
this.configId = ids?.config ? ids.config : SUI_CONFIG_IDS[cluster];
|
|
7009
|
-
this.feeTableId = ids?.feeTable ? ids.feeTable : SUI_FEE_TABLE_IDS[cluster];
|
|
7010
|
-
this.client = new SuiClient({ url: clusterUrl });
|
|
7011
|
-
}
|
|
7012
|
-
/**
|
|
7013
|
-
* Creates a new stream/vesting contract.
|
|
7014
|
-
*/
|
|
7015
|
-
async create(streamData, { senderWallet }) {
|
|
7016
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7017
|
-
const totalFee = await this.getTotalFee({
|
|
7018
|
-
address: streamData.partner ?? wallet.address
|
|
7019
|
-
});
|
|
7020
|
-
const [tx] = await this.generateCreateBlock(
|
|
7021
|
-
wallet.address,
|
|
7022
|
-
{
|
|
7023
|
-
...streamData,
|
|
7024
|
-
recipients: [{ ...streamData }]
|
|
7025
|
-
},
|
|
7026
|
-
totalFee
|
|
7027
|
-
);
|
|
7028
|
-
const { digest, events } = await wallet.signAndExecuteTransaction({
|
|
7029
|
-
transaction: tx,
|
|
7030
|
-
options: { showEvents: true }
|
|
7031
|
-
});
|
|
7032
|
-
return {
|
|
7033
|
-
ixs: [],
|
|
7034
|
-
txId: digest,
|
|
7035
|
-
metadataId: events[0].parsedJson.address
|
|
7036
|
-
};
|
|
7037
|
-
}
|
|
7038
|
-
/**
|
|
7039
|
-
* Creates multiple stream/vesting contracts.
|
|
7040
|
-
* We don't chain transactions in one Block so that one failed transaction does not revert all others.
|
|
7041
|
-
*/
|
|
7042
|
-
async createMultiple(multipleStreamData, { senderWallet }) {
|
|
7043
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7044
|
-
const totalFee = await this.getTotalFee({
|
|
7045
|
-
address: multipleStreamData.partner ?? wallet.address
|
|
7046
|
-
});
|
|
7047
|
-
const [tx, firstIndex] = await this.generateCreateBlock(wallet.address, multipleStreamData, totalFee);
|
|
7048
|
-
const txs = [];
|
|
7049
|
-
const metadatas = [];
|
|
7050
|
-
const metadataToRecipient = {};
|
|
7051
|
-
const errors = [];
|
|
7052
|
-
try {
|
|
7053
|
-
const executedTx = await wallet.signAndExecuteTransaction({
|
|
7054
|
-
transaction: tx,
|
|
7055
|
-
options: { showEffects: true, showEvents: true }
|
|
7056
|
-
});
|
|
7057
|
-
const digest = executedTx.digest;
|
|
7058
|
-
const { events, effects } = !executedTx.effects || typeof executedTx.effects === "string" ? await getTransactionBlock(this.client, { digest, options: { showEvents: true, showEffects: true } }) : executedTx;
|
|
7059
|
-
txs.push(digest);
|
|
7060
|
-
if (effects.status.status === "failure") {
|
|
7061
|
-
multipleStreamData.recipients.forEach((recipient) => {
|
|
7062
|
-
errors.push({
|
|
7063
|
-
error: effects.status.error ?? "Unknown error!",
|
|
7064
|
-
recipient: recipient.recipient
|
|
7065
|
-
});
|
|
7066
|
-
});
|
|
7067
|
-
} else {
|
|
7068
|
-
multipleStreamData.recipients.forEach((recipient, index) => {
|
|
7069
|
-
const metadataId = events[index].parsedJson.address;
|
|
7070
|
-
metadatas.push(metadataId);
|
|
7071
|
-
metadataToRecipient[metadataId] = recipient;
|
|
7072
|
-
});
|
|
7073
|
-
}
|
|
7074
|
-
} catch (e) {
|
|
7075
|
-
const errorInfo = extractSuiErrorInfo(e.toString() ?? "Unknown error!");
|
|
7076
|
-
multipleStreamData.recipients.forEach((recipient, index) => {
|
|
7077
|
-
if (errorInfo.index === void 0 || errorInfo.index < index + firstIndex || errorInfo.index >= multipleStreamData.recipients.length + firstIndex || errorInfo.index === index + firstIndex) {
|
|
7078
|
-
errors.push({
|
|
7079
|
-
error: errorInfo.text,
|
|
7080
|
-
recipient: recipient.recipient,
|
|
7081
|
-
contractErrorCode: errorInfo.parsed?.name
|
|
7082
|
-
});
|
|
7083
|
-
}
|
|
7084
|
-
});
|
|
7085
|
-
}
|
|
7086
|
-
return {
|
|
7087
|
-
txs,
|
|
7088
|
-
metadatas,
|
|
7089
|
-
metadataToRecipient,
|
|
7090
|
-
errors
|
|
7091
|
-
};
|
|
7092
|
-
}
|
|
7093
|
-
/**
|
|
7094
|
-
* Attempts withdrawing from the specified stream.
|
|
7095
|
-
*/
|
|
7096
|
-
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { senderWallet, tokenId }) {
|
|
7097
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7098
|
-
const tx = new Transaction();
|
|
7099
|
-
tx.moveCall({
|
|
7100
|
-
target: `${this.programId}::protocol::withdraw`,
|
|
7101
|
-
typeArguments: [tokenId],
|
|
7102
|
-
arguments: [
|
|
7103
|
-
tx.object(id),
|
|
7104
|
-
tx.object(this.configId),
|
|
7105
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
7106
|
-
tx.pure.u64(amount.toString())
|
|
7107
|
-
]
|
|
7108
|
-
});
|
|
7109
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7110
|
-
transaction: tx
|
|
7111
|
-
});
|
|
7112
|
-
return {
|
|
7113
|
-
ixs: [],
|
|
7114
|
-
txId: digest
|
|
7115
|
-
};
|
|
7116
|
-
}
|
|
7117
|
-
/**
|
|
7118
|
-
* Attempts canceling the specified stream.
|
|
7119
|
-
*/
|
|
7120
|
-
async cancel(cancelData, { senderWallet, tokenId }) {
|
|
7121
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7122
|
-
const tx = new Transaction();
|
|
7123
|
-
tx.moveCall({
|
|
7124
|
-
target: `${this.programId}::protocol::cancel`,
|
|
7125
|
-
typeArguments: [tokenId],
|
|
7126
|
-
arguments: [tx.object(cancelData.id), tx.object(this.configId), tx.object(SUI_CLOCK_OBJECT_ID)]
|
|
7127
|
-
});
|
|
7128
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7129
|
-
transaction: tx
|
|
7130
|
-
});
|
|
7131
|
-
return {
|
|
7132
|
-
ixs: [],
|
|
7133
|
-
txId: digest
|
|
7134
|
-
};
|
|
7135
|
-
}
|
|
7136
|
-
/**
|
|
7137
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
7138
|
-
*/
|
|
7139
|
-
async transfer(transferData, { senderWallet, tokenId }) {
|
|
7140
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7141
|
-
const tx = new Transaction();
|
|
7142
|
-
tx.moveCall({
|
|
7143
|
-
target: `${this.programId}::protocol::transfer`,
|
|
7144
|
-
typeArguments: [tokenId],
|
|
7145
|
-
arguments: [tx.object(transferData.id), tx.pure.address(transferData.newRecipient)]
|
|
7146
|
-
});
|
|
7147
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7148
|
-
transaction: tx
|
|
7149
|
-
});
|
|
7150
|
-
return {
|
|
7151
|
-
ixs: [],
|
|
7152
|
-
txId: digest
|
|
7153
|
-
};
|
|
7154
|
-
}
|
|
7155
|
-
/**
|
|
7156
|
-
* Tops up stream account with specified amount.
|
|
7157
|
-
*/
|
|
7158
|
-
async topup(topupData, { senderWallet, tokenId }) {
|
|
7159
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7160
|
-
const tx = new Transaction();
|
|
7161
|
-
const coins = await this.getAllCoins(wallet.address, tokenId);
|
|
7162
|
-
const stream = await this.getOne({ id: topupData.id });
|
|
7163
|
-
const totalFee = (stream.partnerFeePercent + stream.streamflowFeePercent) / 100;
|
|
7164
|
-
const coinObject = this.splitCoinObjectForAmount(tx, topupData.amount, tokenId, coins, totalFee);
|
|
7165
|
-
tx.moveCall({
|
|
7166
|
-
target: `${this.programId}::protocol::topup`,
|
|
7167
|
-
typeArguments: [tokenId],
|
|
7168
|
-
arguments: [
|
|
7169
|
-
tx.object(topupData.id),
|
|
7170
|
-
tx.object(this.configId),
|
|
7171
|
-
coinObject,
|
|
7172
|
-
tx.gas,
|
|
7173
|
-
tx.pure.u64(topupData.amount.toString())
|
|
7174
|
-
]
|
|
7175
|
-
});
|
|
7176
|
-
this.returnSplittedCoinObject(tx, tokenId, coins, coinObject);
|
|
7177
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7178
|
-
transaction: tx
|
|
7179
|
-
});
|
|
7180
|
-
return {
|
|
7181
|
-
ixs: [],
|
|
7182
|
-
txId: digest
|
|
7183
|
-
};
|
|
7184
|
-
}
|
|
7185
|
-
/**
|
|
7186
|
-
* Fetch stream data by its id (address).
|
|
7187
|
-
*/
|
|
7188
|
-
async getOne({ id }) {
|
|
7189
|
-
const response = await this.client.getObject({
|
|
7190
|
-
id,
|
|
7191
|
-
options: {
|
|
7192
|
-
showContent: true
|
|
7193
|
-
}
|
|
7194
|
-
});
|
|
7195
|
-
if (!response.data) {
|
|
7196
|
-
throw new Error(`Contract with id ${id} could not be found!`);
|
|
7197
|
-
}
|
|
7198
|
-
const content = response.data.content;
|
|
7199
|
-
if (content.dataType !== "moveObject") {
|
|
7200
|
-
throw new Error(`Not a Move Object!`);
|
|
7201
|
-
}
|
|
7202
|
-
return new Contract3(
|
|
7203
|
-
content.fields,
|
|
7204
|
-
"0x97e9a9fb1392e9785319f5512d0bfde6ecf7757b09c6de41cec89e798dd361f2::strmt::STRMT"
|
|
7205
|
-
);
|
|
7206
|
-
}
|
|
7207
|
-
async get() {
|
|
7208
|
-
throw new Error("Get all method is not supported for Sui chain!");
|
|
7209
|
-
}
|
|
7210
|
-
/**
|
|
7211
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
7212
|
-
*/
|
|
7213
|
-
async update(updateData, { senderWallet, tokenId }) {
|
|
7214
|
-
const wallet = new SuiWalletWrapper(senderWallet, this.client);
|
|
7215
|
-
const tx = new Transaction();
|
|
7216
|
-
tx.moveCall({
|
|
7217
|
-
target: `${this.programId}::protocol::update`,
|
|
7218
|
-
typeArguments: [tokenId],
|
|
7219
|
-
arguments: [
|
|
7220
|
-
tx.object(updateData.id),
|
|
7221
|
-
tx.object(this.configId),
|
|
7222
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
7223
|
-
tx.gas,
|
|
7224
|
-
bcs.vector(bcs.bool()).serialize(updateData.enableAutomaticWithdrawal !== void 0 ? [updateData.enableAutomaticWithdrawal] : []),
|
|
7225
|
-
bcs.vector(bcs.u64()).serialize(updateData.withdrawFrequency !== void 0 ? [updateData.withdrawFrequency.toString()] : []),
|
|
7226
|
-
bcs.vector(bcs.u64()).serialize(updateData.amountPerPeriod !== void 0 ? [updateData.amountPerPeriod.toString()] : [])
|
|
7227
|
-
]
|
|
7228
|
-
});
|
|
7229
|
-
const { digest } = await wallet.signAndExecuteTransaction({
|
|
7230
|
-
transaction: tx
|
|
7231
|
-
});
|
|
7232
|
-
return {
|
|
7233
|
-
ixs: [],
|
|
7234
|
-
txId: digest
|
|
7235
|
-
};
|
|
7236
|
-
}
|
|
7237
|
-
extractErrorCode(err) {
|
|
7238
|
-
const errorInfo = extractSuiErrorInfo(err.toString() ?? "Unknown error!");
|
|
7239
|
-
return errorInfo?.parsed?.name || null;
|
|
7240
|
-
}
|
|
7241
|
-
async getFees({ address }) {
|
|
7242
|
-
const response = await this.client.getObject({
|
|
7243
|
-
id: this.feeTableId,
|
|
7244
|
-
options: {
|
|
7245
|
-
showContent: true
|
|
7246
|
-
}
|
|
7247
|
-
});
|
|
7248
|
-
const content = response.data.content;
|
|
7249
|
-
if (content.dataType !== "moveObject") {
|
|
7250
|
-
throw new Error(`Not a Move Object!`);
|
|
7251
|
-
}
|
|
7252
|
-
const fields = content.fields;
|
|
7253
|
-
const fieldsResponse = await this.client.getDynamicFields({
|
|
7254
|
-
parentId: fields.values.fields.id.id
|
|
7255
|
-
});
|
|
7256
|
-
const partnerDynamicField = fieldsResponse.data.filter((item) => item.name.value === address)[0];
|
|
7257
|
-
if (!partnerDynamicField) {
|
|
7258
|
-
return null;
|
|
7259
|
-
}
|
|
7260
|
-
const valueResponse = await this.client.getObject({
|
|
7261
|
-
id: partnerDynamicField.objectId,
|
|
7262
|
-
options: {
|
|
7263
|
-
showContent: true
|
|
7264
|
-
}
|
|
7265
|
-
});
|
|
7266
|
-
const valueContent = valueResponse.data.content;
|
|
7267
|
-
if (valueContent.dataType !== "moveObject") {
|
|
7268
|
-
throw new Error(`Not a Move Object!`);
|
|
7269
|
-
}
|
|
7270
|
-
const valueFields = valueContent.fields.value.fields;
|
|
7271
|
-
return {
|
|
7272
|
-
streamflowFee: Number(valueFields.streamflow_fee) / 100,
|
|
7273
|
-
partnerFee: Number(valueFields.partner_fee) / 100
|
|
7274
|
-
};
|
|
7275
|
-
}
|
|
7276
|
-
async getDefaultStreamflowFee() {
|
|
7277
|
-
const response = await this.client.getObject({
|
|
7278
|
-
id: this.configId,
|
|
7279
|
-
options: {
|
|
7280
|
-
showContent: true
|
|
7281
|
-
}
|
|
7282
|
-
});
|
|
7283
|
-
const content = response.data.content;
|
|
7284
|
-
if (content.dataType !== "moveObject") {
|
|
7285
|
-
throw new Error(`Not a Move Object!`);
|
|
7286
|
-
}
|
|
7287
|
-
const fields = content.fields;
|
|
7288
|
-
return Number(fields.streamflow_fee) / 100;
|
|
7289
|
-
}
|
|
7290
|
-
/**
|
|
7291
|
-
* Returns StreamClient protocol program ID.
|
|
7292
|
-
*/
|
|
7293
|
-
getProgramId() {
|
|
7294
|
-
return this.programId;
|
|
7295
|
-
}
|
|
7296
|
-
/**
|
|
7297
|
-
* Utility function to generate Transaction Block to create streams
|
|
7298
|
-
*/
|
|
7299
|
-
async generateCreateBlock(walletAddress, multipleStreamData, totalFee) {
|
|
7300
|
-
let coins = await this.getAllCoins(walletAddress, multipleStreamData.tokenId);
|
|
7301
|
-
const totalAmount = multipleStreamData.recipients.map((recipiient) => recipiient.amount).reduce((prev, current) => current.add(prev));
|
|
7302
|
-
const tx = new Transaction();
|
|
7303
|
-
const coinObject = this.splitCoinObjectForAmount(tx, totalAmount, multipleStreamData.tokenId, coins, totalFee);
|
|
7304
|
-
coins = [coins[0]];
|
|
7305
|
-
let firstIndex = null;
|
|
7306
|
-
multipleStreamData.recipients.forEach((recipient) => {
|
|
7307
|
-
const result = tx.moveCall({
|
|
7308
|
-
target: `${this.programId}::protocol::create`,
|
|
7309
|
-
typeArguments: [multipleStreamData.tokenId],
|
|
7310
|
-
arguments: [
|
|
7311
|
-
tx.object(this.configId),
|
|
7312
|
-
tx.object(this.feeTableId),
|
|
7313
|
-
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
7314
|
-
coinObject,
|
|
7315
|
-
tx.gas,
|
|
7316
|
-
tx.pure.u64(recipient.amount.toString()),
|
|
7317
|
-
tx.pure.u64(multipleStreamData.period),
|
|
7318
|
-
tx.pure.u64(recipient.amountPerPeriod.toString()),
|
|
7319
|
-
tx.pure.u64(multipleStreamData.start),
|
|
7320
|
-
tx.pure.u64(recipient.cliffAmount.toString()),
|
|
7321
|
-
tx.pure.bool(multipleStreamData.cancelableBySender),
|
|
7322
|
-
tx.pure.bool(multipleStreamData.cancelableByRecipient),
|
|
7323
|
-
tx.pure.bool(multipleStreamData.transferableBySender),
|
|
7324
|
-
tx.pure.bool(multipleStreamData.transferableByRecipient),
|
|
7325
|
-
tx.pure.bool(multipleStreamData.canTopup),
|
|
7326
|
-
tx.pure.bool(!!multipleStreamData.canPause),
|
|
7327
|
-
tx.pure.bool(!!multipleStreamData.canUpdateRate),
|
|
7328
|
-
tx.pure.bool(!!multipleStreamData.automaticWithdrawal),
|
|
7329
|
-
tx.pure.u64(multipleStreamData.withdrawalFrequency || 0),
|
|
7330
|
-
tx.pure.string(recipient.name),
|
|
7331
|
-
tx.pure.address(recipient.recipient),
|
|
7332
|
-
tx.pure.address(multipleStreamData.partner || walletAddress)
|
|
7333
|
-
]
|
|
7334
|
-
});
|
|
7335
|
-
if (result.$kind === "Result" && firstIndex === null) {
|
|
7336
|
-
firstIndex = result.Result;
|
|
7337
|
-
}
|
|
7338
|
-
});
|
|
7339
|
-
this.returnSplittedCoinObject(tx, multipleStreamData.tokenId, coins, coinObject);
|
|
7340
|
-
return [tx, firstIndex];
|
|
7341
|
-
}
|
|
7342
|
-
/**
|
|
7343
|
-
* Returns all coins owned by a Wallet
|
|
7344
|
-
* @param walletAddress wallet address
|
|
7345
|
-
* @param coinType coin type
|
|
7346
|
-
* @returns Array of Coin Structs
|
|
7347
|
-
*/
|
|
7348
|
-
async getAllCoins(walletAddress, coinType) {
|
|
7349
|
-
let coinsResponse = await this.client.getCoins({
|
|
7350
|
-
owner: walletAddress,
|
|
7351
|
-
coinType
|
|
7352
|
-
});
|
|
7353
|
-
const coins = coinsResponse.data;
|
|
7354
|
-
while (coinsResponse.hasNextPage) {
|
|
7355
|
-
coinsResponse = await this.client.getCoins({
|
|
7356
|
-
owner: walletAddress,
|
|
7357
|
-
coinType,
|
|
7358
|
-
cursor: coinsResponse.nextCursor
|
|
7359
|
-
});
|
|
7360
|
-
coins.push(...coinsResponse.data);
|
|
7361
|
-
}
|
|
7362
|
-
return coins;
|
|
7363
|
-
}
|
|
7364
|
-
/**
|
|
7365
|
-
* Utility function to split Coin object and use splitted object for stream operations.
|
|
7366
|
-
* We do it like thid to mitigate risk of Transaction reverting in case Stream is created for Sui Coin object.
|
|
7367
|
-
* This way we can safely pass splitted Sui Coin object in Stream payload and use another object for gas/withdrawal fees.
|
|
7368
|
-
* @param tx current transanction block
|
|
7369
|
-
* @param amount minimal amount of coins requried
|
|
7370
|
-
* @param coinType coin type
|
|
7371
|
-
* @param coins array of owned coins of the same type
|
|
7372
|
-
* @param totalFee partner and treasury fees
|
|
7373
|
-
* @returns Coin Object to use in a Move Call
|
|
7374
|
-
*/
|
|
7375
|
-
splitCoinObjectForAmount(tx, amount, coinType, coins, totalFee) {
|
|
7376
|
-
const coinObject = coinType === SUI_TYPE_ARG ? tx.gas : tx.object(coins[0].coinObjectId);
|
|
7377
|
-
if (coins.length > 1) {
|
|
7378
|
-
tx.mergeCoins(
|
|
7379
|
-
coinObject,
|
|
7380
|
-
coins.slice(1).map((item) => tx.object(item.coinObjectId))
|
|
7381
|
-
);
|
|
7382
|
-
}
|
|
7383
|
-
const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
|
|
7384
|
-
return tx.splitCoins(coinObject, [tx.pure.u64(totalAmount.toString())])[0];
|
|
7385
|
-
}
|
|
7386
|
-
/**
|
|
7387
|
-
* Return previously splitted Coin Object to owner and merge it to to rebate storage fees
|
|
7388
|
-
* @param tx current transaction
|
|
7389
|
-
* @param coinType coin type
|
|
7390
|
-
* @param coinObject splitted object
|
|
7391
|
-
* @param coins array of objects used in
|
|
7392
|
-
*/
|
|
7393
|
-
returnSplittedCoinObject(tx, coinType, coins, coinObject) {
|
|
7394
|
-
const firstCoinObject = coinType === SUI_TYPE_ARG ? tx.gas : tx.object(coins[0].coinObjectId);
|
|
7395
|
-
tx.mergeCoins(firstCoinObject, [coinObject]);
|
|
7396
|
-
}
|
|
7397
|
-
};
|
|
7398
|
-
|
|
7399
|
-
// common/GenericStreamClient.ts
|
|
7400
|
-
var GenericStreamClient = class extends BaseStreamClient {
|
|
7401
|
-
constructor(options) {
|
|
7402
|
-
super();
|
|
7403
|
-
this.chain = options.chain;
|
|
7404
|
-
switch (options.chain) {
|
|
7405
|
-
case IChain.Solana:
|
|
7406
|
-
this.nativeStreamClient = new SolanaStreamClient(options);
|
|
7407
|
-
break;
|
|
7408
|
-
case IChain.Aptos:
|
|
7409
|
-
this.nativeStreamClient = new AptosStreamClient(
|
|
7410
|
-
options.clusterUrl,
|
|
7411
|
-
options.cluster,
|
|
7412
|
-
options.maxGas,
|
|
7413
|
-
options.programId
|
|
7414
|
-
);
|
|
7415
|
-
break;
|
|
7416
|
-
case IChain.BNB:
|
|
7417
|
-
case IChain.Ethereum:
|
|
7418
|
-
case IChain.Polygon:
|
|
7419
|
-
this.nativeStreamClient = new EvmStreamClient(
|
|
7420
|
-
options.clusterUrl,
|
|
7421
|
-
options.chain,
|
|
7422
|
-
options.signer,
|
|
7423
|
-
options.cluster,
|
|
7424
|
-
options.programId
|
|
7425
|
-
);
|
|
7426
|
-
break;
|
|
7427
|
-
case IChain.Sui:
|
|
7428
|
-
this.nativeStreamClient = new SuiStreamClient(
|
|
7429
|
-
options.clusterUrl,
|
|
7430
|
-
options.cluster,
|
|
7431
|
-
options.ids
|
|
7432
|
-
);
|
|
7433
|
-
}
|
|
7434
|
-
}
|
|
7435
|
-
/**
|
|
7436
|
-
* Creates a new stream/vesting contract.
|
|
7437
|
-
*/
|
|
7438
|
-
create(streamData, chainSpecificParams) {
|
|
7439
|
-
return handleContractError(
|
|
7440
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7441
|
-
() => this.nativeStreamClient.create(streamData, chainSpecificParams),
|
|
7442
|
-
this.nativeStreamClient.extractErrorCode
|
|
7443
|
-
);
|
|
7444
|
-
}
|
|
7445
|
-
/**
|
|
7446
|
-
* Creates multiple stream/vesting contracts.
|
|
7447
|
-
*/
|
|
7448
|
-
createMultiple(multipleStreamData, chainSpecificParams) {
|
|
7449
|
-
return handleContractError(
|
|
7450
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7451
|
-
() => this.nativeStreamClient.createMultiple(multipleStreamData, chainSpecificParams),
|
|
7452
|
-
this.nativeStreamClient.extractErrorCode
|
|
7453
|
-
);
|
|
7454
|
-
}
|
|
7455
|
-
/**
|
|
7456
|
-
* Attempts withdrawing from the specified stream.
|
|
7457
|
-
*/
|
|
7458
|
-
withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, chainSpecificParams) {
|
|
7459
|
-
return handleContractError(
|
|
7460
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7461
|
-
() => this.nativeStreamClient.withdraw({ id, amount }, chainSpecificParams),
|
|
7462
|
-
this.nativeStreamClient.extractErrorCode
|
|
7463
|
-
);
|
|
7464
|
-
}
|
|
7465
|
-
/**
|
|
7466
|
-
* Attempts canceling the specified stream.
|
|
7467
|
-
*/
|
|
7468
|
-
cancel(cancelData, chainSpecificParams) {
|
|
7469
|
-
return handleContractError(
|
|
7470
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7471
|
-
() => this.nativeStreamClient.cancel(cancelData, chainSpecificParams),
|
|
7472
|
-
this.nativeStreamClient.extractErrorCode
|
|
7473
|
-
);
|
|
7474
|
-
}
|
|
7475
|
-
/**
|
|
7476
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
7477
|
-
*/
|
|
7478
|
-
transfer(transferData, chainSpecificParams) {
|
|
7479
|
-
return handleContractError(
|
|
7480
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7481
|
-
() => this.nativeStreamClient.transfer(transferData, chainSpecificParams),
|
|
7482
|
-
this.nativeStreamClient.extractErrorCode
|
|
7483
|
-
);
|
|
7484
|
-
}
|
|
7485
|
-
/**
|
|
7486
|
-
* Tops up stream account with specified amount.
|
|
7487
|
-
*/
|
|
7488
|
-
topup(topupData, chainSpecificParams) {
|
|
7489
|
-
return handleContractError(
|
|
7490
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7491
|
-
() => this.nativeStreamClient.topup(topupData, chainSpecificParams),
|
|
7492
|
-
this.nativeStreamClient.extractErrorCode
|
|
7493
|
-
);
|
|
7494
|
-
}
|
|
7495
|
-
/**
|
|
7496
|
-
* Fetch stream data by its id (address).
|
|
7497
|
-
*/
|
|
7498
|
-
getOne(getOneData) {
|
|
7499
|
-
return this.nativeStreamClient.getOne(getOneData);
|
|
7500
|
-
}
|
|
7501
|
-
/**
|
|
7502
|
-
* Fetch streams by sender or recipient address.
|
|
7503
|
-
*/
|
|
7504
|
-
get(getAllData) {
|
|
7505
|
-
return this.nativeStreamClient.get(getAllData);
|
|
7506
|
-
}
|
|
7507
|
-
/**
|
|
7508
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
7509
|
-
*/
|
|
7510
|
-
update(updateData, chainSpecificParams) {
|
|
7511
|
-
return handleContractError(
|
|
7512
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7513
|
-
() => this.nativeStreamClient.update(updateData, chainSpecificParams),
|
|
7514
|
-
this.nativeStreamClient.extractErrorCode
|
|
7515
|
-
);
|
|
7516
|
-
}
|
|
7517
|
-
/**
|
|
7518
|
-
* Returns streamflow and partner fees for the specific wallet in %
|
|
7519
|
-
*/
|
|
7520
|
-
getFees(getFeesData) {
|
|
7521
|
-
return this.nativeStreamClient.getFees(getFeesData);
|
|
7522
|
-
}
|
|
7523
|
-
/**
|
|
7524
|
-
* Returns default Streamflow Fee in %
|
|
7525
|
-
*/
|
|
7526
|
-
getDefaultStreamflowFee() {
|
|
7527
|
-
return this.nativeStreamClient.getDefaultStreamflowFee();
|
|
7528
|
-
}
|
|
7529
|
-
};
|
|
7530
|
-
|
|
7531
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, BASE_FEE, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, ContractErrorCode, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, GenericStreamClient, MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaAlignedProxyErrorCode, SolanaContractErrorCode, StreamDirection, StreamType, aptos_exports as StreamflowAptos, evm_exports as StreamflowEVM, solana_exports as StreamflowSolana, sui_exports as StreamflowSui, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, decodeEndTime, getBN, getNumberFromBN, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isPayment, isTokenLock, isVesting };
|
|
4153
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isPayment, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
|
7532
4154
|
//# sourceMappingURL=index.js.map
|
|
7533
4155
|
//# sourceMappingURL=index.js.map
|