@streamflow/stream 7.0.0-alpha.11 → 7.0.0-alpha.13
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 +22 -17
- package/dist/cjs/__tests__/aptos/streamClient.spec.js +4 -4
- package/dist/cjs/aptos/types.js +12 -12
- package/dist/cjs/common/constants.js +4 -3
- package/dist/cjs/common/contractUtils.js +23 -7
- package/dist/cjs/common/types.js +30 -1
- package/dist/cjs/common/utils.js +22 -19
- package/dist/cjs/evm/StreamClient.js +7 -7
- package/dist/cjs/evm/types.js +12 -12
- package/dist/cjs/solana/StreamClient.js +256 -111
- package/dist/cjs/solana/constants.js +29 -1
- package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +2 -0
- package/dist/cjs/solana/index.js +2 -1
- package/dist/cjs/solana/instructions.js +18 -19
- package/dist/cjs/solana/lib/derive-accounts.js +17 -0
- package/dist/cjs/solana/{utils.js → lib/utils.js} +29 -36
- package/dist/cjs/solana/types.js +26 -3
- package/dist/cjs/sui/StreamClient.js +1 -1
- package/dist/cjs/sui/types.js +12 -12
- package/dist/esm/__tests__/aptos/streamClient.spec.js +4 -4
- package/dist/esm/aptos/types.d.ts +14 -14
- package/dist/esm/aptos/types.js +13 -13
- package/dist/esm/common/constants.d.ts +3 -2
- package/dist/esm/common/constants.js +3 -2
- package/dist/esm/common/contractUtils.d.ts +18 -15
- package/dist/esm/common/contractUtils.js +19 -6
- package/dist/esm/common/types.d.ts +112 -57
- package/dist/esm/common/types.js +29 -0
- package/dist/esm/common/utils.d.ts +11 -11
- package/dist/esm/common/utils.js +19 -16
- package/dist/esm/evm/StreamClient.d.ts +2 -2
- package/dist/esm/evm/StreamClient.js +7 -7
- package/dist/esm/evm/types.d.ts +14 -14
- package/dist/esm/evm/types.js +13 -13
- package/dist/esm/solana/StreamClient.d.ts +20 -14
- package/dist/esm/solana/StreamClient.js +259 -113
- package/dist/esm/solana/constants.d.ts +14 -0
- package/dist/esm/solana/constants.js +29 -1
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +1272 -0
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +1 -0
- package/dist/esm/solana/index.d.ts +2 -1
- package/dist/esm/solana/index.js +2 -1
- package/dist/esm/solana/instructions.d.ts +17 -17
- package/dist/esm/solana/instructions.js +18 -19
- package/dist/esm/solana/lib/derive-accounts.d.ts +4 -0
- package/dist/esm/solana/lib/derive-accounts.js +11 -0
- package/dist/esm/solana/{utils.d.ts → lib/utils.d.ts} +1 -3
- package/dist/esm/solana/{utils.js → lib/utils.js} +28 -34
- package/dist/esm/solana/types.d.ts +67 -39
- package/dist/esm/solana/types.js +32 -4
- package/dist/esm/sui/StreamClient.js +1 -1
- package/dist/esm/sui/types.d.ts +14 -14
- package/dist/esm/sui/types.js +13 -13
- package/package.json +7 -5
package/dist/esm/sui/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BN from "bn.js";
|
|
2
2
|
import { buildStreamType, calculateUnlockedAmount } from "../common/contractUtils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getNumberFromBN } 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 = new BN(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 = new BN(0);
|
|
67
|
+
this.streamflowFeeWithdrawn = new BN(0);
|
|
68
68
|
this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 10000;
|
|
69
|
-
this.partnerFeeTotal =
|
|
70
|
-
this.partnerFeeWithdrawn =
|
|
69
|
+
this.partnerFeeTotal = new BN(0);
|
|
70
|
+
this.partnerFeeWithdrawn = new BN(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 = new BN(stream.amount);
|
|
76
76
|
this.period = parseInt(stream.period);
|
|
77
|
-
this.amountPerPeriod =
|
|
77
|
+
this.amountPerPeriod = new BN(stream.amount_per_period);
|
|
78
78
|
this.cliff = parseInt(stream.start);
|
|
79
|
-
this.cliffAmount =
|
|
79
|
+
this.cliffAmount = new BN(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 = new BN(stream.pause_cumulative);
|
|
91
91
|
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
92
|
-
this.fundsUnlockedAtLastRateChange =
|
|
92
|
+
this.fundsUnlockedAtLastRateChange = new BN(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 getNumberFromBN(this.depositedAmount.sub(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.13",
|
|
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,14 +42,16 @@
|
|
|
42
42
|
"lint": "eslint --fix .",
|
|
43
43
|
"prepublishOnly": "npm run lint && npm test && npm run build"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "1fe1f2d828e28cfd9e842bb4dd47c9756a39404f",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@streamflow/eslint-config": "7.0.0-alpha.
|
|
47
|
+
"@streamflow/eslint-config": "7.0.0-alpha.13",
|
|
48
|
+
"@types/bn.js": "5.1.1",
|
|
48
49
|
"@types/ethereum-checksum-address": "^0.0.0",
|
|
49
50
|
"date-fns": "2.28.0",
|
|
50
51
|
"typescript": "^5.3.3"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
54
|
+
"@coral-xyz/anchor": "^0.30.0",
|
|
53
55
|
"@coral-xyz/borsh": "0.30.1",
|
|
54
56
|
"@manahippo/aptos-wallet-adapter": "1.0.10",
|
|
55
57
|
"@mysten/sui.js": "0.54.1",
|
|
@@ -57,10 +59,10 @@
|
|
|
57
59
|
"@solana/spl-token": "0.3.6",
|
|
58
60
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
59
61
|
"@solana/web3.js": "1.90.2",
|
|
60
|
-
"@streamflow/common": "7.0.0-alpha.
|
|
62
|
+
"@streamflow/common": "7.0.0-alpha.13",
|
|
61
63
|
"@suiet/wallet-kit": "0.2.22",
|
|
62
64
|
"aptos": "1.21.0",
|
|
63
|
-
"
|
|
65
|
+
"bn.js": "5.2.1",
|
|
64
66
|
"borsh": "^2.0.0",
|
|
65
67
|
"bs58": "5.0.0",
|
|
66
68
|
"ethereum-checksum-address": "0.0.8",
|