@streamflow/stream 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +674 -0
  2. package/package.json +5 -6
  3. package/dist/__tests__/aptos/streamClient.spec.d.ts +0 -1
  4. package/dist/__tests__/aptos/streamClient.spec.js +0 -161
  5. package/dist/aptos/StreamClient.d.ts +0 -51
  6. package/dist/aptos/StreamClient.js +0 -387
  7. package/dist/aptos/constants.d.ts +0 -8
  8. package/dist/aptos/constants.js +0 -28
  9. package/dist/aptos/index.d.ts +0 -2
  10. package/dist/aptos/index.js +0 -24
  11. package/dist/aptos/types.d.ts +0 -97
  12. package/dist/aptos/types.js +0 -76
  13. package/dist/aptos/utils.d.ts +0 -1
  14. package/dist/aptos/utils.js +0 -12
  15. package/dist/aptos/wallet.d.ts +0 -9
  16. package/dist/aptos/wallet.js +0 -89
  17. package/dist/common/BaseStreamClient.d.ts +0 -13
  18. package/dist/common/BaseStreamClient.js +0 -13
  19. package/dist/common/GenericStreamClient.d.ts +0 -93
  20. package/dist/common/GenericStreamClient.js +0 -114
  21. package/dist/common/constants.d.ts +0 -1
  22. package/dist/common/constants.js +0 -4
  23. package/dist/common/contractUtils.d.ts +0 -47
  24. package/dist/common/contractUtils.js +0 -55
  25. package/dist/common/types.d.ts +0 -252
  26. package/dist/common/types.js +0 -165
  27. package/dist/common/utils.d.ts +0 -22
  28. package/dist/common/utils.js +0 -101
  29. package/dist/evm/StreamClient.d.ts +0 -30
  30. package/dist/evm/StreamClient.js +0 -461
  31. package/dist/evm/abi.d.ts +0 -111
  32. package/dist/evm/abi.js +0 -1257
  33. package/dist/evm/constants.d.ts +0 -20
  34. package/dist/evm/constants.js +0 -39
  35. package/dist/evm/ercAbi.d.ts +0 -39
  36. package/dist/evm/ercAbi.js +0 -224
  37. package/dist/evm/index.d.ts +0 -2
  38. package/dist/evm/index.js +0 -24
  39. package/dist/evm/types.d.ts +0 -93
  40. package/dist/evm/types.js +0 -75
  41. package/dist/evm/utils.d.ts +0 -1
  42. package/dist/evm/utils.js +0 -12
  43. package/dist/index.d.ts +0 -8
  44. package/dist/index.js +0 -41
  45. package/dist/solana/StreamClient.d.ts +0 -72
  46. package/dist/solana/StreamClient.js +0 -927
  47. package/dist/solana/constants.d.ts +0 -22
  48. package/dist/solana/constants.js +0 -50
  49. package/dist/solana/index.d.ts +0 -7
  50. package/dist/solana/index.js +0 -43
  51. package/dist/solana/instructionTypes.d.ts +0 -96
  52. package/dist/solana/instructionTypes.js +0 -2
  53. package/dist/solana/instructions.d.ts +0 -139
  54. package/dist/solana/instructions.js +0 -407
  55. package/dist/solana/layout.d.ts +0 -27
  56. package/dist/solana/layout.js +0 -170
  57. package/dist/solana/timelockIDL.d.ts +0 -22
  58. package/dist/solana/timelockIDL.js +0 -422
  59. package/dist/solana/types.d.ts +0 -292
  60. package/dist/solana/types.js +0 -81
  61. package/dist/solana/utils.d.ts +0 -44
  62. package/dist/solana/utils.js +0 -303
  63. package/dist/sui/StreamClient.d.ts +0 -79
  64. package/dist/sui/StreamClient.js +0 -571
  65. package/dist/sui/constants.d.ts +0 -10
  66. package/dist/sui/constants.js +0 -43
  67. package/dist/sui/index.d.ts +0 -2
  68. package/dist/sui/index.js +0 -23
  69. package/dist/sui/types.d.ts +0 -141
  70. package/dist/sui/types.js +0 -102
  71. package/dist/sui/utils.d.ts +0 -2
  72. package/dist/sui/utils.js +0 -29
  73. package/dist/sui/wallet.d.ts +0 -11
  74. package/dist/sui/wallet.js +0 -75
@@ -1,141 +0,0 @@
1
- import { Keypair } from "@mysten/sui.js/cryptography";
2
- import { WalletContextState } from "@suiet/wallet-kit";
3
- import { TransactionBlock } from "@mysten/sui.js/transactions";
4
- import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions } from "@mysten/sui.js/client";
5
- import BN from "bn.js";
6
- import { Stream, StreamType } from "../common/types";
7
- export interface ICreateStreamSuiExt {
8
- senderWallet: WalletContextState | Keypair;
9
- }
10
- export interface ITransactionSuiExt {
11
- senderWallet: WalletContextState | Keypair;
12
- tokenId: string;
13
- }
14
- export interface ISuiIdParameters {
15
- program: string;
16
- config: string;
17
- feeTable: string;
18
- }
19
- export interface IContractCreated {
20
- address: string;
21
- }
22
- export interface IContractWithdrawn {
23
- address: string;
24
- amount: number;
25
- streamflow_amount: number;
26
- partner_amount: number;
27
- }
28
- export interface StreamResource {
29
- id: {
30
- id: string;
31
- };
32
- amount: string;
33
- amount_per_period: string;
34
- balance: string;
35
- canceled_at: string;
36
- cliff_amount: string;
37
- closed: boolean;
38
- created: string;
39
- current_pause_start: string;
40
- end: string;
41
- fees: {
42
- fields: {
43
- partner_fee: string;
44
- partner_fee_percentage: string;
45
- partner_fee_withdrawn: string;
46
- streamflow_fee: string;
47
- streamflow_fee_percentage: string;
48
- streamflow_fee_withdrawn: string;
49
- };
50
- type: string;
51
- };
52
- funds_unlocked_at_last_rate_change: string;
53
- last_rate_change_time: string;
54
- last_withdrawn_at: string;
55
- meta: {
56
- fields: {
57
- automatic_withdrawal: boolean;
58
- can_topup: boolean;
59
- can_update_rate: boolean;
60
- cancelable_by_recipient: boolean;
61
- cancelable_by_sender: boolean;
62
- contract_name: number[];
63
- pausable: boolean;
64
- transferable_by_recipient: boolean;
65
- transferable_by_sender: boolean;
66
- withdrawal_frequency: string;
67
- };
68
- type: string;
69
- };
70
- partner: string;
71
- pause_cumulative: string;
72
- period: string;
73
- recipient: string;
74
- sender: string;
75
- start: string;
76
- version: string;
77
- withdrawn: string;
78
- }
79
- export declare class Contract implements Stream {
80
- magic: number;
81
- version: number;
82
- createdAt: number;
83
- withdrawnAmount: BN;
84
- canceledAt: number;
85
- end: number;
86
- lastWithdrawnAt: number;
87
- sender: string;
88
- senderTokens: string;
89
- recipient: string;
90
- recipientTokens: string;
91
- mint: string;
92
- escrowTokens: string;
93
- streamflowTreasury: string;
94
- streamflowTreasuryTokens: string;
95
- streamflowFeeTotal: BN;
96
- streamflowFeeWithdrawn: BN;
97
- streamflowFeePercent: number;
98
- partnerFeeTotal: BN;
99
- partnerFeeWithdrawn: BN;
100
- partnerFeePercent: number;
101
- partner: string;
102
- partnerTokens: string;
103
- start: number;
104
- depositedAmount: BN;
105
- period: number;
106
- amountPerPeriod: BN;
107
- cliff: number;
108
- cliffAmount: BN;
109
- cancelableBySender: boolean;
110
- cancelableByRecipient: boolean;
111
- automaticWithdrawal: boolean;
112
- transferableBySender: boolean;
113
- transferableByRecipient: boolean;
114
- canTopup: boolean;
115
- name: string;
116
- withdrawalFrequency: number;
117
- closed: boolean;
118
- currentPauseStart: number;
119
- pauseCumulative: BN;
120
- lastRateChangeTime: number;
121
- fundsUnlockedAtLastRateChange: BN;
122
- type: StreamType;
123
- constructor(stream: StreamResource, tokenId: string);
124
- unlocked(currentTimestamp: number): BN;
125
- remaining(decimals: number): number;
126
- }
127
- export interface SuiParsedError {
128
- module: "protocol" | "admin" | "fee_manager";
129
- code: number;
130
- name: string;
131
- }
132
- export interface SuiErrorInfo {
133
- index?: number;
134
- text: string;
135
- parsed?: SuiParsedError;
136
- }
137
- export interface SuiSignAndExecuteTransactionBlockInput {
138
- transactionBlock: TransactionBlock;
139
- requestType?: ExecuteTransactionRequestType;
140
- options?: SuiTransactionBlockResponseOptions;
141
- }
package/dist/sui/types.js DELETED
@@ -1,102 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __read = (this && this.__read) || function (o, n) {
14
- var m = typeof Symbol === "function" && o[Symbol.iterator];
15
- if (!m) return o;
16
- var i = m.call(o), r, ar = [], e;
17
- try {
18
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
- }
20
- catch (error) { e = { error: error }; }
21
- finally {
22
- try {
23
- if (r && !r.done && (m = i["return"])) m.call(i);
24
- }
25
- finally { if (e) throw e.error; }
26
- }
27
- return ar;
28
- };
29
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
- if (ar || !(i in from)) {
32
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
- ar[i] = from[i];
34
- }
35
- }
36
- return to.concat(ar || Array.prototype.slice.call(from));
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.Contract = void 0;
43
- var bn_js_1 = __importDefault(require("bn.js"));
44
- var contractUtils_1 = require("../common/contractUtils");
45
- var utils_1 = require("../common/utils");
46
- var Contract = /** @class */ (function () {
47
- function Contract(stream, tokenId) {
48
- var meta = stream.meta.fields;
49
- var fees = stream.fees.fields;
50
- this.magic = 0;
51
- this.version = parseInt(stream.version);
52
- this.createdAt = parseInt(stream.created);
53
- this.withdrawnAmount = new bn_js_1.default(stream.withdrawn);
54
- this.canceledAt = parseInt(stream.canceled_at);
55
- this.end = parseInt(stream.end);
56
- this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
57
- this.sender = stream.sender;
58
- this.senderTokens = stream.sender;
59
- this.recipient = stream.recipient;
60
- this.recipientTokens = stream.recipient;
61
- this.mint = tokenId;
62
- this.escrowTokens = "";
63
- this.streamflowTreasury = "";
64
- this.streamflowTreasuryTokens = "";
65
- this.streamflowFeeTotal = new bn_js_1.default(0);
66
- this.streamflowFeeWithdrawn = new bn_js_1.default(0);
67
- this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 10000;
68
- this.partnerFeeTotal = new bn_js_1.default(0);
69
- this.partnerFeeWithdrawn = new bn_js_1.default(0);
70
- this.partnerFeePercent = parseInt(fees.partner_fee_percentage) / 10000;
71
- this.partner = stream.partner;
72
- this.partnerTokens = "";
73
- this.start = parseInt(stream.start);
74
- this.depositedAmount = new bn_js_1.default(stream.amount);
75
- this.period = parseInt(stream.period);
76
- this.amountPerPeriod = new bn_js_1.default(stream.amount_per_period);
77
- this.cliff = parseInt(stream.start);
78
- this.cliffAmount = new bn_js_1.default(stream.cliff_amount);
79
- this.cancelableBySender = meta.cancelable_by_sender;
80
- this.cancelableByRecipient = meta.cancelable_by_recipient;
81
- this.automaticWithdrawal = meta.automatic_withdrawal;
82
- this.transferableBySender = meta.transferable_by_sender;
83
- this.transferableByRecipient = meta.transferable_by_recipient;
84
- this.canTopup = meta.can_topup;
85
- this.name = String.fromCharCode.apply(String, __spreadArray([], __read(meta.contract_name), false));
86
- this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
87
- this.closed = stream.closed;
88
- this.currentPauseStart = parseInt(stream.current_pause_start);
89
- this.pauseCumulative = new bn_js_1.default(stream.pause_cumulative);
90
- this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
91
- this.fundsUnlockedAtLastRateChange = new bn_js_1.default(stream.funds_unlocked_at_last_rate_change);
92
- this.type = (0, contractUtils_1.buildStreamType)(this);
93
- }
94
- Contract.prototype.unlocked = function (currentTimestamp) {
95
- return (0, contractUtils_1.calculateUnlockedAmount)(__assign(__assign({}, this), { currentTimestamp: currentTimestamp }));
96
- };
97
- Contract.prototype.remaining = function (decimals) {
98
- return (0, utils_1.getNumberFromBN)(this.depositedAmount.sub(this.withdrawnAmount), decimals);
99
- };
100
- return Contract;
101
- }());
102
- exports.Contract = Contract;
@@ -1,2 +0,0 @@
1
- import { SuiErrorInfo } from "./types";
2
- export declare function extractSuiErrorInfo(errorText: string): SuiErrorInfo;
package/dist/sui/utils.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractSuiErrorInfo = void 0;
4
- var constants_1 = require("./constants");
5
- function extractSuiErrorInfo(errorText) {
6
- var error = { text: errorText };
7
- var match = constants_1.SUI_ERROR_MATCH_REGEX.exec(errorText);
8
- if (!match) {
9
- return error;
10
- }
11
- var moduleName = match[2];
12
- var errorCode = Number(match[4]);
13
- var errorName = constants_1.SUI_MODULE_ERROR_MAP[moduleName]
14
- ? constants_1.SUI_MODULE_ERROR_MAP[moduleName][errorCode]
15
- : undefined;
16
- var index = Number(match[5]);
17
- if (index) {
18
- error.index = index;
19
- }
20
- if (errorName) {
21
- error.parsed = {
22
- module: moduleName,
23
- code: errorCode,
24
- name: errorName,
25
- };
26
- }
27
- return error;
28
- }
29
- exports.extractSuiErrorInfo = extractSuiErrorInfo;
@@ -1,11 +0,0 @@
1
- import { Keypair } from "@mysten/sui.js/cryptography";
2
- import { WalletContextState } from "@suiet/wallet-kit";
3
- import { SuiClient, SuiTransactionBlockResponse } from "@mysten/sui.js/client";
4
- import { SuiSignAndExecuteTransactionBlockInput } from "./types";
5
- export declare class SuiWalletWrapper<T extends WalletContextState | Keypair> {
6
- wallet: T;
7
- address: string;
8
- client: SuiClient;
9
- constructor(wallet: T, client: SuiClient);
10
- signAndExecuteTransactionBlock(input: SuiSignAndExecuteTransactionBlockInput): Promise<SuiTransactionBlockResponse>;
11
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.SuiWalletWrapper = void 0;
51
- var cryptography_1 = require("@mysten/sui.js/cryptography");
52
- var SuiWalletWrapper = /** @class */ (function () {
53
- function SuiWalletWrapper(wallet, client) {
54
- this.client = client;
55
- this.wallet = wallet;
56
- if (wallet instanceof cryptography_1.Keypair) {
57
- this.address = wallet.toSuiAddress();
58
- }
59
- else {
60
- this.address = wallet.address;
61
- }
62
- }
63
- SuiWalletWrapper.prototype.signAndExecuteTransactionBlock = function (input) {
64
- return __awaiter(this, void 0, void 0, function () {
65
- return __generator(this, function (_a) {
66
- if (this.wallet instanceof cryptography_1.Keypair) {
67
- return [2 /*return*/, this.client.signAndExecuteTransactionBlock(__assign(__assign({}, input), { signer: this.wallet }))];
68
- }
69
- return [2 /*return*/, this.wallet.signAndExecuteTransactionBlock(input)];
70
- });
71
- });
72
- };
73
- return SuiWalletWrapper;
74
- }());
75
- exports.SuiWalletWrapper = SuiWalletWrapper;