@streamflow/stream 7.0.0-alpha.1 → 7.0.0-alpha.11
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 +65 -68
- package/dist/cjs/__tests__/aptos/streamClient.spec.js +83 -134
- package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +9 -9
- package/dist/cjs/aptos/StreamClient.js +162 -367
- package/dist/cjs/aptos/constants.js +7 -8
- package/dist/cjs/aptos/index.js +3 -3
- package/dist/cjs/aptos/types.js +32 -41
- package/dist/cjs/aptos/utils.js +4 -4
- package/dist/cjs/aptos/wallet.js +20 -75
- package/dist/cjs/common/BaseStreamClient.js +11 -59
- package/dist/cjs/common/GenericStreamClient.js +46 -72
- package/dist/cjs/common/constants.js +2 -2
- package/dist/cjs/common/contractUtils.js +16 -17
- package/dist/cjs/common/utils.js +34 -84
- package/dist/cjs/evm/StreamClient.js +198 -456
- package/dist/cjs/evm/constants.js +19 -20
- package/dist/cjs/evm/types.js +25 -34
- package/dist/cjs/evm/utils.js +2 -2
- package/dist/cjs/index.js +10 -10
- package/dist/cjs/solana/StreamClient.js +608 -1090
- package/dist/cjs/solana/constants.js +16 -11
- package/dist/cjs/solana/instructions.js +76 -80
- package/dist/cjs/solana/layout.js +7 -8
- package/dist/cjs/solana/types.js +15 -25
- package/dist/cjs/solana/utils.js +77 -154
- package/dist/cjs/sui/StreamClient.js +325 -571
- package/dist/cjs/sui/constants.js +19 -20
- package/dist/cjs/sui/types.js +28 -62
- package/dist/cjs/sui/utils.js +7 -7
- package/dist/cjs/sui/wallet.js +13 -63
- package/dist/esm/__tests__/aptos/streamClient.spec.js +4 -4
- package/dist/esm/aptos/index.d.ts +3 -3
- package/dist/esm/aptos/index.js +3 -3
- package/dist/esm/aptos/types.d.ts +12 -12
- package/dist/esm/aptos/types.js +13 -13
- package/dist/esm/common/GenericStreamClient.d.ts +4 -4
- package/dist/esm/common/GenericStreamClient.js +4 -4
- package/dist/esm/common/constants.d.ts +2 -2
- package/dist/esm/common/constants.js +2 -2
- package/dist/esm/common/contractUtils.d.ts +14 -14
- package/dist/esm/common/contractUtils.js +6 -6
- package/dist/esm/common/types.d.ts +19 -19
- package/dist/esm/common/utils.d.ts +11 -11
- package/dist/esm/common/utils.js +16 -19
- package/dist/esm/evm/StreamClient.d.ts +2 -2
- package/dist/esm/evm/StreamClient.js +7 -7
- package/dist/esm/evm/types.d.ts +37 -37
- package/dist/esm/evm/types.js +13 -13
- package/dist/esm/index.d.ts +9 -9
- package/dist/esm/index.js +9 -9
- package/dist/esm/solana/StreamClient.d.ts +3 -1
- package/dist/esm/solana/StreamClient.js +38 -22
- package/dist/esm/solana/constants.d.ts +3 -0
- package/dist/esm/solana/constants.js +6 -0
- package/dist/esm/solana/instructions.d.ts +17 -17
- package/dist/esm/solana/instructions.js +19 -18
- package/dist/esm/solana/types.d.ts +41 -36
- package/dist/esm/solana/types.js +2 -2
- package/dist/esm/solana/utils.d.ts +2 -0
- package/dist/esm/solana/utils.js +32 -26
- package/dist/esm/sui/StreamClient.js +1 -1
- package/dist/esm/sui/types.d.ts +12 -12
- package/dist/esm/sui/types.js +13 -13
- package/package.json +10 -11
package/dist/esm/sui/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Keypair } from "@mysten/sui.js/cryptography";
|
|
|
2
2
|
import { WalletContextState } from "@suiet/wallet-kit";
|
|
3
3
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
4
4
|
import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions } from "@mysten/sui.js/client";
|
|
5
|
-
import
|
|
5
|
+
import BigNumber from "bignumber.js";
|
|
6
6
|
import { Stream, StreamType } from "../common/types.js";
|
|
7
7
|
export interface ICreateStreamSuiExt {
|
|
8
8
|
senderWallet: WalletContextState | Keypair;
|
|
@@ -106,7 +106,7 @@ export declare class Contract implements Stream {
|
|
|
106
106
|
magic: number;
|
|
107
107
|
version: number;
|
|
108
108
|
createdAt: number;
|
|
109
|
-
withdrawnAmount:
|
|
109
|
+
withdrawnAmount: BigNumber;
|
|
110
110
|
canceledAt: number;
|
|
111
111
|
end: number;
|
|
112
112
|
lastWithdrawnAt: number;
|
|
@@ -118,20 +118,20 @@ export declare class Contract implements Stream {
|
|
|
118
118
|
escrowTokens: string;
|
|
119
119
|
streamflowTreasury: string;
|
|
120
120
|
streamflowTreasuryTokens: string;
|
|
121
|
-
streamflowFeeTotal:
|
|
122
|
-
streamflowFeeWithdrawn:
|
|
121
|
+
streamflowFeeTotal: BigNumber;
|
|
122
|
+
streamflowFeeWithdrawn: BigNumber;
|
|
123
123
|
streamflowFeePercent: number;
|
|
124
|
-
partnerFeeTotal:
|
|
125
|
-
partnerFeeWithdrawn:
|
|
124
|
+
partnerFeeTotal: BigNumber;
|
|
125
|
+
partnerFeeWithdrawn: BigNumber;
|
|
126
126
|
partnerFeePercent: number;
|
|
127
127
|
partner: string;
|
|
128
128
|
partnerTokens: string;
|
|
129
129
|
start: number;
|
|
130
|
-
depositedAmount:
|
|
130
|
+
depositedAmount: BigNumber;
|
|
131
131
|
period: number;
|
|
132
|
-
amountPerPeriod:
|
|
132
|
+
amountPerPeriod: BigNumber;
|
|
133
133
|
cliff: number;
|
|
134
|
-
cliffAmount:
|
|
134
|
+
cliffAmount: BigNumber;
|
|
135
135
|
cancelableBySender: boolean;
|
|
136
136
|
cancelableByRecipient: boolean;
|
|
137
137
|
automaticWithdrawal: boolean;
|
|
@@ -142,12 +142,12 @@ export declare class Contract implements Stream {
|
|
|
142
142
|
withdrawalFrequency: number;
|
|
143
143
|
closed: boolean;
|
|
144
144
|
currentPauseStart: number;
|
|
145
|
-
pauseCumulative:
|
|
145
|
+
pauseCumulative: BigNumber;
|
|
146
146
|
lastRateChangeTime: number;
|
|
147
|
-
fundsUnlockedAtLastRateChange:
|
|
147
|
+
fundsUnlockedAtLastRateChange: BigNumber;
|
|
148
148
|
type: StreamType;
|
|
149
149
|
constructor(stream: StreamResource, tokenId: string);
|
|
150
|
-
unlocked(currentTimestamp: number):
|
|
150
|
+
unlocked(currentTimestamp: number): BigNumber;
|
|
151
151
|
remaining(decimals: number): number;
|
|
152
152
|
}
|
|
153
153
|
export interface SuiParsedError {
|
package/dist/esm/sui/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
2
|
import { buildStreamType, calculateUnlockedAmount } from "../common/contractUtils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getNumberFromBigNumber } from "../common/utils.js";
|
|
4
4
|
export class Contract {
|
|
5
5
|
magic;
|
|
6
6
|
version;
|
|
@@ -51,7 +51,7 @@ export class Contract {
|
|
|
51
51
|
this.magic = 0;
|
|
52
52
|
this.version = parseInt(stream.version);
|
|
53
53
|
this.createdAt = parseInt(stream.created);
|
|
54
|
-
this.withdrawnAmount =
|
|
54
|
+
this.withdrawnAmount = BigNumber(stream.withdrawn);
|
|
55
55
|
this.canceledAt = parseInt(stream.canceled_at);
|
|
56
56
|
this.end = parseInt(stream.end);
|
|
57
57
|
this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
|
|
@@ -63,20 +63,20 @@ export class Contract {
|
|
|
63
63
|
this.escrowTokens = "";
|
|
64
64
|
this.streamflowTreasury = "";
|
|
65
65
|
this.streamflowTreasuryTokens = "";
|
|
66
|
-
this.streamflowFeeTotal =
|
|
67
|
-
this.streamflowFeeWithdrawn =
|
|
66
|
+
this.streamflowFeeTotal = BigNumber(0);
|
|
67
|
+
this.streamflowFeeWithdrawn = BigNumber(0);
|
|
68
68
|
this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 10000;
|
|
69
|
-
this.partnerFeeTotal =
|
|
70
|
-
this.partnerFeeWithdrawn =
|
|
69
|
+
this.partnerFeeTotal = BigNumber(0);
|
|
70
|
+
this.partnerFeeWithdrawn = BigNumber(0);
|
|
71
71
|
this.partnerFeePercent = parseInt(fees.partner_fee_percentage) / 10000;
|
|
72
72
|
this.partner = stream.partner;
|
|
73
73
|
this.partnerTokens = "";
|
|
74
74
|
this.start = parseInt(stream.start);
|
|
75
|
-
this.depositedAmount =
|
|
75
|
+
this.depositedAmount = BigNumber(stream.amount);
|
|
76
76
|
this.period = parseInt(stream.period);
|
|
77
|
-
this.amountPerPeriod =
|
|
77
|
+
this.amountPerPeriod = BigNumber(stream.amount_per_period);
|
|
78
78
|
this.cliff = parseInt(stream.start);
|
|
79
|
-
this.cliffAmount =
|
|
79
|
+
this.cliffAmount = BigNumber(stream.cliff_amount);
|
|
80
80
|
this.cancelableBySender = meta.cancelable_by_sender;
|
|
81
81
|
this.cancelableByRecipient = meta.cancelable_by_recipient;
|
|
82
82
|
this.automaticWithdrawal = meta.automatic_withdrawal;
|
|
@@ -87,9 +87,9 @@ export class Contract {
|
|
|
87
87
|
this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
|
|
88
88
|
this.closed = stream.closed;
|
|
89
89
|
this.currentPauseStart = parseInt(stream.current_pause_start);
|
|
90
|
-
this.pauseCumulative =
|
|
90
|
+
this.pauseCumulative = BigNumber(stream.pause_cumulative);
|
|
91
91
|
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
92
|
-
this.fundsUnlockedAtLastRateChange =
|
|
92
|
+
this.fundsUnlockedAtLastRateChange = BigNumber(stream.funds_unlocked_at_last_rate_change);
|
|
93
93
|
this.type = buildStreamType(this);
|
|
94
94
|
}
|
|
95
95
|
unlocked(currentTimestamp) {
|
|
@@ -99,6 +99,6 @@ export class Contract {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
remaining(decimals) {
|
|
102
|
-
return
|
|
102
|
+
return getNumberFromBigNumber(this.depositedAmount.minus(this.withdrawnAmount), decimals);
|
|
103
103
|
}
|
|
104
104
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/stream",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.11",
|
|
4
4
|
"description": "JavaScript SDK to interact with Streamflow protocol.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -42,26 +42,25 @@
|
|
|
42
42
|
"lint": "eslint --fix .",
|
|
43
43
|
"prepublishOnly": "npm run lint && npm test && npm run build"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "679b809cff3ff71f90122bbe985da3f35834452e",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@streamflow/eslint-config": "7.0.0-alpha.
|
|
48
|
-
"@types/bn.js": "5.1.1",
|
|
47
|
+
"@streamflow/eslint-config": "7.0.0-alpha.11",
|
|
49
48
|
"@types/ethereum-checksum-address": "^0.0.0",
|
|
50
49
|
"date-fns": "2.28.0",
|
|
51
50
|
"typescript": "^5.3.3"
|
|
52
51
|
},
|
|
53
52
|
"dependencies": {
|
|
54
|
-
"@coral-xyz/borsh": "
|
|
55
|
-
"@manahippo/aptos-wallet-adapter": "1.0.
|
|
56
|
-
"@mysten/sui.js": "
|
|
53
|
+
"@coral-xyz/borsh": "0.30.1",
|
|
54
|
+
"@manahippo/aptos-wallet-adapter": "1.0.10",
|
|
55
|
+
"@mysten/sui.js": "0.54.1",
|
|
57
56
|
"@solana/buffer-layout": "4.0.1 ",
|
|
58
57
|
"@solana/spl-token": "0.3.6",
|
|
59
58
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
60
|
-
"@solana/web3.js": "1.
|
|
61
|
-
"@streamflow/common": "7.0.0-alpha.
|
|
59
|
+
"@solana/web3.js": "1.90.2",
|
|
60
|
+
"@streamflow/common": "7.0.0-alpha.11",
|
|
62
61
|
"@suiet/wallet-kit": "0.2.22",
|
|
63
|
-
"aptos": "1.
|
|
64
|
-
"
|
|
62
|
+
"aptos": "1.21.0",
|
|
63
|
+
"bignumber.js": "^9.1.2",
|
|
65
64
|
"borsh": "^2.0.0",
|
|
66
65
|
"bs58": "5.0.0",
|
|
67
66
|
"ethereum-checksum-address": "0.0.8",
|