@streamflow/stream 5.5.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.
- package/LICENSE +674 -0
- package/README.md +5 -6
- package/package.json +5 -5
- package/dist/__tests__/aptos/streamClient.spec.d.ts +0 -1
- package/dist/__tests__/aptos/streamClient.spec.js +0 -161
- package/dist/aptos/StreamClient.d.ts +0 -50
- package/dist/aptos/StreamClient.js +0 -383
- package/dist/aptos/constants.d.ts +0 -2
- package/dist/aptos/constants.js +0 -12
- package/dist/aptos/index.d.ts +0 -2
- package/dist/aptos/index.js +0 -24
- package/dist/aptos/types.d.ts +0 -97
- package/dist/aptos/types.js +0 -76
- package/dist/aptos/wallet.d.ts +0 -9
- package/dist/aptos/wallet.js +0 -83
- package/dist/common/BaseStreamClient.d.ts +0 -12
- package/dist/common/BaseStreamClient.js +0 -9
- package/dist/common/GenericStreamClient.d.ts +0 -83
- package/dist/common/GenericStreamClient.js +0 -102
- package/dist/common/constants.d.ts +0 -1
- package/dist/common/constants.js +0 -4
- package/dist/common/contractUtils.d.ts +0 -47
- package/dist/common/contractUtils.js +0 -55
- package/dist/common/types.d.ts +0 -149
- package/dist/common/types.js +0 -33
- package/dist/common/utils.d.ts +0 -15
- package/dist/common/utils.js +0 -34
- package/dist/evm/StreamClient.d.ts +0 -29
- package/dist/evm/StreamClient.js +0 -456
- package/dist/evm/abi.d.ts +0 -111
- package/dist/evm/abi.js +0 -1257
- package/dist/evm/constants.d.ts +0 -4
- package/dist/evm/constants.js +0 -23
- package/dist/evm/ercAbi.d.ts +0 -39
- package/dist/evm/ercAbi.js +0 -224
- package/dist/evm/index.d.ts +0 -2
- package/dist/evm/index.js +0 -24
- package/dist/evm/types.d.ts +0 -93
- package/dist/evm/types.js +0 -75
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -41
- package/dist/solana/StreamClient.d.ts +0 -71
- package/dist/solana/StreamClient.js +0 -923
- package/dist/solana/constants.d.ts +0 -18
- package/dist/solana/constants.js +0 -24
- package/dist/solana/index.d.ts +0 -7
- package/dist/solana/index.js +0 -43
- package/dist/solana/instructionTypes.d.ts +0 -96
- package/dist/solana/instructionTypes.js +0 -2
- package/dist/solana/instructions.d.ts +0 -139
- package/dist/solana/instructions.js +0 -407
- package/dist/solana/layout.d.ts +0 -27
- package/dist/solana/layout.js +0 -170
- package/dist/solana/timelockIDL.d.ts +0 -22
- package/dist/solana/timelockIDL.js +0 -422
- package/dist/solana/types.d.ts +0 -292
- package/dist/solana/types.js +0 -81
- package/dist/solana/utils.d.ts +0 -43
- package/dist/solana/utils.js +0 -283
- package/dist/sui/StreamClient.d.ts +0 -78
- package/dist/sui/StreamClient.js +0 -545
- package/dist/sui/constants.d.ts +0 -4
- package/dist/sui/constants.js +0 -24
- package/dist/sui/index.d.ts +0 -2
- package/dist/sui/index.js +0 -23
- package/dist/sui/types.d.ts +0 -131
- package/dist/sui/types.js +0 -102
- package/dist/sui/wallet.d.ts +0 -11
- package/dist/sui/wallet.js +0 -75
package/dist/common/types.d.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { TransactionInstruction } from "@solana/web3.js";
|
|
2
|
-
import { Types } from "aptos";
|
|
3
|
-
import BN from "bn.js";
|
|
4
|
-
export interface IRecipient {
|
|
5
|
-
recipient: string;
|
|
6
|
-
amount: BN;
|
|
7
|
-
name: string;
|
|
8
|
-
cliffAmount: BN;
|
|
9
|
-
amountPerPeriod: BN;
|
|
10
|
-
}
|
|
11
|
-
export interface IStreamConfig {
|
|
12
|
-
period: number;
|
|
13
|
-
start: number;
|
|
14
|
-
cliff: number;
|
|
15
|
-
cancelableBySender: boolean;
|
|
16
|
-
cancelableByRecipient: boolean;
|
|
17
|
-
transferableBySender: boolean;
|
|
18
|
-
transferableByRecipient: boolean;
|
|
19
|
-
canTopup: boolean;
|
|
20
|
-
automaticWithdrawal?: boolean;
|
|
21
|
-
withdrawalFrequency?: number;
|
|
22
|
-
tokenId: string;
|
|
23
|
-
canPause?: boolean;
|
|
24
|
-
canUpdateRate?: boolean;
|
|
25
|
-
partner?: string;
|
|
26
|
-
}
|
|
27
|
-
export declare type ICreateStreamData = IStreamConfig & IRecipient;
|
|
28
|
-
export declare type ICreateMultipleStreamData = IStreamConfig & {
|
|
29
|
-
recipients: IRecipient[];
|
|
30
|
-
};
|
|
31
|
-
export interface IWithdrawData {
|
|
32
|
-
id: string;
|
|
33
|
-
amount: BN;
|
|
34
|
-
}
|
|
35
|
-
export interface IUpdateData {
|
|
36
|
-
id: string;
|
|
37
|
-
enableAutomaticWithdrawal?: boolean;
|
|
38
|
-
withdrawFrequency?: BN;
|
|
39
|
-
amountPerPeriod?: BN;
|
|
40
|
-
}
|
|
41
|
-
export interface ICancelData {
|
|
42
|
-
id: string;
|
|
43
|
-
}
|
|
44
|
-
export interface ITransferData {
|
|
45
|
-
id: string;
|
|
46
|
-
newRecipient: string;
|
|
47
|
-
}
|
|
48
|
-
export interface ITopUpData {
|
|
49
|
-
id: string;
|
|
50
|
-
amount: BN;
|
|
51
|
-
}
|
|
52
|
-
export interface IGetOneData {
|
|
53
|
-
id: string;
|
|
54
|
-
}
|
|
55
|
-
export interface IGetAllData {
|
|
56
|
-
address: string;
|
|
57
|
-
type?: StreamType;
|
|
58
|
-
direction?: StreamDirection;
|
|
59
|
-
}
|
|
60
|
-
export interface ICreateMultiError {
|
|
61
|
-
recipient: string;
|
|
62
|
-
error: string;
|
|
63
|
-
}
|
|
64
|
-
declare type MetadataId = string;
|
|
65
|
-
export interface ITransactionResult {
|
|
66
|
-
ixs: (TransactionInstruction | Types.TransactionPayload)[];
|
|
67
|
-
txId: string;
|
|
68
|
-
}
|
|
69
|
-
export interface ICreateResult extends ITransactionResult {
|
|
70
|
-
metadataId: MetadataId;
|
|
71
|
-
}
|
|
72
|
-
export interface IMultiTransactionResult {
|
|
73
|
-
txs: string[];
|
|
74
|
-
metadatas: MetadataId[];
|
|
75
|
-
metadataToRecipient: Record<MetadataId, IRecipient>;
|
|
76
|
-
errors: ICreateMultiError[];
|
|
77
|
-
}
|
|
78
|
-
export declare enum ICluster {
|
|
79
|
-
Mainnet = "mainnet",
|
|
80
|
-
Devnet = "devnet",
|
|
81
|
-
Testnet = "testnet",
|
|
82
|
-
Local = "local"
|
|
83
|
-
}
|
|
84
|
-
export declare enum StreamDirection {
|
|
85
|
-
Outgoing = "outgoing",
|
|
86
|
-
Incoming = "incoming",
|
|
87
|
-
All = "all"
|
|
88
|
-
}
|
|
89
|
-
export declare enum StreamType {
|
|
90
|
-
All = "all",
|
|
91
|
-
Payment = "payment",
|
|
92
|
-
Vesting = "vesting",
|
|
93
|
-
Lock = "lock"
|
|
94
|
-
}
|
|
95
|
-
export declare enum IChain {
|
|
96
|
-
Solana = "Solana",
|
|
97
|
-
Aptos = "Aptos",
|
|
98
|
-
Ethereum = "Ethereum",
|
|
99
|
-
BNB = "BNB",
|
|
100
|
-
Polygon = "Polygon",
|
|
101
|
-
Sui = "Sui"
|
|
102
|
-
}
|
|
103
|
-
export interface Stream {
|
|
104
|
-
magic: number;
|
|
105
|
-
version: number;
|
|
106
|
-
createdAt: number;
|
|
107
|
-
withdrawnAmount: BN;
|
|
108
|
-
canceledAt: number;
|
|
109
|
-
end: number;
|
|
110
|
-
lastWithdrawnAt: number;
|
|
111
|
-
sender: string;
|
|
112
|
-
senderTokens: string;
|
|
113
|
-
recipient: string;
|
|
114
|
-
recipientTokens: string;
|
|
115
|
-
mint: string;
|
|
116
|
-
escrowTokens: string;
|
|
117
|
-
streamflowTreasury: string;
|
|
118
|
-
streamflowTreasuryTokens: string;
|
|
119
|
-
streamflowFeeTotal: BN;
|
|
120
|
-
streamflowFeeWithdrawn: BN;
|
|
121
|
-
streamflowFeePercent: number;
|
|
122
|
-
partnerFeeTotal: BN;
|
|
123
|
-
partnerFeeWithdrawn: BN;
|
|
124
|
-
partnerFeePercent: number;
|
|
125
|
-
partner: string;
|
|
126
|
-
partnerTokens: string;
|
|
127
|
-
start: number;
|
|
128
|
-
depositedAmount: BN;
|
|
129
|
-
period: number;
|
|
130
|
-
amountPerPeriod: BN;
|
|
131
|
-
cliff: number;
|
|
132
|
-
cliffAmount: BN;
|
|
133
|
-
cancelableBySender: boolean;
|
|
134
|
-
cancelableByRecipient: boolean;
|
|
135
|
-
automaticWithdrawal: boolean;
|
|
136
|
-
transferableBySender: boolean;
|
|
137
|
-
transferableByRecipient: boolean;
|
|
138
|
-
canTopup: boolean;
|
|
139
|
-
name: string;
|
|
140
|
-
withdrawalFrequency: number;
|
|
141
|
-
closed: boolean;
|
|
142
|
-
currentPauseStart: number;
|
|
143
|
-
pauseCumulative: BN;
|
|
144
|
-
lastRateChangeTime: number;
|
|
145
|
-
fundsUnlockedAtLastRateChange: BN;
|
|
146
|
-
type: StreamType;
|
|
147
|
-
unlocked(currentTimestamp: number): BN;
|
|
148
|
-
}
|
|
149
|
-
export {};
|
package/dist/common/types.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IChain = exports.StreamType = exports.StreamDirection = exports.ICluster = void 0;
|
|
4
|
-
// Utility types
|
|
5
|
-
var ICluster;
|
|
6
|
-
(function (ICluster) {
|
|
7
|
-
ICluster["Mainnet"] = "mainnet";
|
|
8
|
-
ICluster["Devnet"] = "devnet";
|
|
9
|
-
ICluster["Testnet"] = "testnet";
|
|
10
|
-
ICluster["Local"] = "local";
|
|
11
|
-
})(ICluster = exports.ICluster || (exports.ICluster = {}));
|
|
12
|
-
var StreamDirection;
|
|
13
|
-
(function (StreamDirection) {
|
|
14
|
-
StreamDirection["Outgoing"] = "outgoing";
|
|
15
|
-
StreamDirection["Incoming"] = "incoming";
|
|
16
|
-
StreamDirection["All"] = "all";
|
|
17
|
-
})(StreamDirection = exports.StreamDirection || (exports.StreamDirection = {}));
|
|
18
|
-
var StreamType;
|
|
19
|
-
(function (StreamType) {
|
|
20
|
-
StreamType["All"] = "all";
|
|
21
|
-
StreamType["Payment"] = "payment";
|
|
22
|
-
StreamType["Vesting"] = "vesting";
|
|
23
|
-
StreamType["Lock"] = "lock";
|
|
24
|
-
})(StreamType = exports.StreamType || (exports.StreamType = {}));
|
|
25
|
-
var IChain;
|
|
26
|
-
(function (IChain) {
|
|
27
|
-
IChain["Solana"] = "Solana";
|
|
28
|
-
IChain["Aptos"] = "Aptos";
|
|
29
|
-
IChain["Ethereum"] = "Ethereum";
|
|
30
|
-
IChain["BNB"] = "BNB";
|
|
31
|
-
IChain["Polygon"] = "Polygon";
|
|
32
|
-
IChain["Sui"] = "Sui";
|
|
33
|
-
})(IChain = exports.IChain || (exports.IChain = {}));
|
package/dist/common/utils.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
|
-
/**
|
|
3
|
-
* Used for conversion of token amounts to their Big Number representation.
|
|
4
|
-
* Get Big Number representation in the smallest units from the same value in the highest units.
|
|
5
|
-
* @param {number} value - Number of tokens you want to convert to its BN representation.
|
|
6
|
-
* @param {number} decimals - Number of decimals the token has.
|
|
7
|
-
*/
|
|
8
|
-
export declare const getBN: (value: number, decimals: number) => BN;
|
|
9
|
-
/**
|
|
10
|
-
* Used for token amounts conversion from their Big Number representation to number.
|
|
11
|
-
* Get value in the highest units from BN representation of the same value in the smallest units.
|
|
12
|
-
* @param {BN} value - Big Number representation of value in the smallest units.
|
|
13
|
-
* @param {number} decimals - Number of decimals the token has.
|
|
14
|
-
*/
|
|
15
|
-
export declare const getNumberFromBN: (value: BN, decimals: number) => number;
|
package/dist/common/utils.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getNumberFromBN = exports.getBN = void 0;
|
|
7
|
-
var bn_js_1 = __importDefault(require("bn.js"));
|
|
8
|
-
/**
|
|
9
|
-
* Used for conversion of token amounts to their Big Number representation.
|
|
10
|
-
* Get Big Number representation in the smallest units from the same value in the highest units.
|
|
11
|
-
* @param {number} value - Number of tokens you want to convert to its BN representation.
|
|
12
|
-
* @param {number} decimals - Number of decimals the token has.
|
|
13
|
-
*/
|
|
14
|
-
var getBN = function (value, decimals) {
|
|
15
|
-
var decimalPart = value - Math.trunc(value);
|
|
16
|
-
var integerPart = new bn_js_1.default(Math.trunc(value));
|
|
17
|
-
var decimalE = new bn_js_1.default(decimalPart * 1e9);
|
|
18
|
-
var sum = integerPart.mul(new bn_js_1.default(1e9)).add(decimalE);
|
|
19
|
-
var resultE = sum.mul(new bn_js_1.default(10).pow(new bn_js_1.default(decimals)));
|
|
20
|
-
return resultE.div(new bn_js_1.default(1e9));
|
|
21
|
-
};
|
|
22
|
-
exports.getBN = getBN;
|
|
23
|
-
/**
|
|
24
|
-
* Used for token amounts conversion from their Big Number representation to number.
|
|
25
|
-
* Get value in the highest units from BN representation of the same value in the smallest units.
|
|
26
|
-
* @param {BN} value - Big Number representation of value in the smallest units.
|
|
27
|
-
* @param {number} decimals - Number of decimals the token has.
|
|
28
|
-
*/
|
|
29
|
-
var getNumberFromBN = function (value, decimals) {
|
|
30
|
-
return value.gt(new bn_js_1.default(Math.pow(2, 53) - 1))
|
|
31
|
-
? value.div(new bn_js_1.default(Math.pow(10, decimals))).toNumber()
|
|
32
|
-
: value.toNumber() / Math.pow(10, decimals);
|
|
33
|
-
};
|
|
34
|
-
exports.getNumberFromBN = getNumberFromBN;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ethers } from "ethers";
|
|
2
|
-
import BN from "bn.js";
|
|
3
|
-
import { BaseStreamClient } from "../common/BaseStreamClient";
|
|
4
|
-
import { ICancelData, IChain, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetAllData, IGetOneData, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, Stream } from "../common/types";
|
|
5
|
-
export default class EvmStreamClient extends BaseStreamClient {
|
|
6
|
-
private programId;
|
|
7
|
-
private provider;
|
|
8
|
-
private signer;
|
|
9
|
-
private readContract;
|
|
10
|
-
private writeContract;
|
|
11
|
-
constructor(clusterUrl: string, chain: IChain, signer: ethers.Signer, cluster?: ICluster, programId?: string);
|
|
12
|
-
create(streamData: ICreateStreamData): Promise<ICreateResult>;
|
|
13
|
-
createMultiple(multipleStreamData: ICreateMultipleStreamData): Promise<IMultiTransactionResult>;
|
|
14
|
-
withdraw(withdrawData: IWithdrawData): Promise<ITransactionResult>;
|
|
15
|
-
cancel(cancelData: ICancelData): Promise<ITransactionResult>;
|
|
16
|
-
transfer(transferData: ITransferData): Promise<ITransactionResult>;
|
|
17
|
-
topup(topupData: ITopUpData): Promise<ITransactionResult>;
|
|
18
|
-
update(updateData: IUpdateData): Promise<ITransactionResult>;
|
|
19
|
-
getOne({ id }: IGetOneData): Promise<Stream>;
|
|
20
|
-
get({ address, direction, }: IGetAllData): Promise<[string, Stream][]>;
|
|
21
|
-
/**
|
|
22
|
-
* Returns StreamClient protocol program ID.
|
|
23
|
-
*/
|
|
24
|
-
getProgramId(): string;
|
|
25
|
-
approveTokens(tokenId: string, amount: BN): Promise<void>;
|
|
26
|
-
private generateMultiPayloads;
|
|
27
|
-
private getFeeParams;
|
|
28
|
-
private formatMetadataId;
|
|
29
|
-
}
|