@streamflow/stream 7.4.12 → 7.4.14
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.
|
@@ -49,6 +49,7 @@ const streamflow_aligned_unlocks_json_1 = __importDefault(require("./descriptor/
|
|
|
49
49
|
const derive_accounts_js_1 = require("./lib/derive-accounts.js");
|
|
50
50
|
const contractUtils_js_1 = require("../common/contractUtils.js");
|
|
51
51
|
const METADATA_ACC_SIZE = 1104;
|
|
52
|
+
const ALIGNED_METADATA_ACC_SIZE = 320;
|
|
52
53
|
class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
|
|
53
54
|
/**
|
|
54
55
|
* Create Stream instance
|
|
@@ -842,6 +843,9 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
|
|
|
842
843
|
bytes: sender,
|
|
843
844
|
},
|
|
844
845
|
},
|
|
846
|
+
{
|
|
847
|
+
dataSize: ALIGNED_METADATA_ACC_SIZE,
|
|
848
|
+
},
|
|
845
849
|
]);
|
|
846
850
|
const streamPubKeys = alignedOutgoingProgramAccounts.map((account) => account.account.stream);
|
|
847
851
|
const streamAccounts = await this.connection.getMultipleAccountsInfo(streamPubKeys, constants_js_1.TX_FINALITY_CONFIRMED);
|
|
@@ -857,11 +861,11 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
|
|
|
857
861
|
const streams = {};
|
|
858
862
|
const alignedStreamsPubKeys = Object.keys(streamRecord);
|
|
859
863
|
const alignedProxyPDAs = alignedStreamsPubKeys.map((streamPubKey) => (0, derive_accounts_js_1.deriveContractPDA)(this.alignedProxyProgram.programId, new web3_js_1.PublicKey(streamPubKey)));
|
|
860
|
-
const alignedProxyAccounts = await this.
|
|
864
|
+
const alignedProxyAccounts = await this.connection.getMultipleAccountsInfo(alignedProxyPDAs);
|
|
861
865
|
alignedProxyAccounts.forEach((account, index) => {
|
|
862
|
-
if (account) {
|
|
866
|
+
if (account && account.data.length === ALIGNED_METADATA_ACC_SIZE) {
|
|
863
867
|
const alignedData = streamRecord[alignedStreamsPubKeys[index]];
|
|
864
|
-
streams[alignedStreamsPubKeys[index]] = new types_js_1.AlignedContract(alignedData, account);
|
|
868
|
+
streams[alignedStreamsPubKeys[index]] = new types_js_1.AlignedContract(alignedData, this.alignedProxyProgram.account.contract.coder.accounts.decode("contract", account.data));
|
|
865
869
|
}
|
|
866
870
|
});
|
|
867
871
|
return streams;
|
package/dist/cjs/solana/types.js
CHANGED
|
@@ -80,6 +80,11 @@ class AlignedContract extends Contract {
|
|
|
80
80
|
this.sender = alignedProxy.sender.toBase58();
|
|
81
81
|
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
82
82
|
this.proxyAddress = stream.sender.toBase58();
|
|
83
|
+
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
84
|
+
this.initialPrice = (0, utils_js_1.getNumberFromBN)(alignedProxy.initialPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW);
|
|
85
|
+
this.lastPrice = (0, utils_js_1.getNumberFromBN)(alignedProxy.lastPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW);
|
|
86
|
+
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
87
|
+
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
83
88
|
// need to call this again since minPrice and maxPrice are used in determining the type
|
|
84
89
|
this.type = (0, contractUtils_js_1.buildStreamType)(this);
|
|
85
90
|
this.isAligned = true;
|
|
@@ -205,6 +205,11 @@ export type AlignedStreamData = {
|
|
|
205
205
|
oracleType: OracleTypeName;
|
|
206
206
|
priceOracle: string | undefined;
|
|
207
207
|
tickSize: number;
|
|
208
|
+
initialAmountPerPeriod: BN;
|
|
209
|
+
initialPrice: number;
|
|
210
|
+
lastPrice: number;
|
|
211
|
+
lastAmountUpdateTime: number;
|
|
212
|
+
initialNetAmount: BN;
|
|
208
213
|
};
|
|
209
214
|
export type AlignedStream = LinearStream & AlignedStreamData;
|
|
210
215
|
export type Stream = LinearStream | AlignedStream;
|
|
@@ -20,6 +20,7 @@ import StreamflowAlignedUnlocksIDL from "./descriptor/idl/streamflow_aligned_unl
|
|
|
20
20
|
import { deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA } from "./lib/derive-accounts.js";
|
|
21
21
|
import { isCreateAlignedStreamData } from "../common/contractUtils.js";
|
|
22
22
|
const METADATA_ACC_SIZE = 1104;
|
|
23
|
+
const ALIGNED_METADATA_ACC_SIZE = 320;
|
|
23
24
|
export class SolanaStreamClient extends BaseStreamClient {
|
|
24
25
|
connection;
|
|
25
26
|
programId;
|
|
@@ -818,6 +819,9 @@ export class SolanaStreamClient extends BaseStreamClient {
|
|
|
818
819
|
bytes: sender,
|
|
819
820
|
},
|
|
820
821
|
},
|
|
822
|
+
{
|
|
823
|
+
dataSize: ALIGNED_METADATA_ACC_SIZE,
|
|
824
|
+
},
|
|
821
825
|
]);
|
|
822
826
|
const streamPubKeys = alignedOutgoingProgramAccounts.map((account) => account.account.stream);
|
|
823
827
|
const streamAccounts = await this.connection.getMultipleAccountsInfo(streamPubKeys, TX_FINALITY_CONFIRMED);
|
|
@@ -833,11 +837,11 @@ export class SolanaStreamClient extends BaseStreamClient {
|
|
|
833
837
|
const streams = {};
|
|
834
838
|
const alignedStreamsPubKeys = Object.keys(streamRecord);
|
|
835
839
|
const alignedProxyPDAs = alignedStreamsPubKeys.map((streamPubKey) => deriveContractPDA(this.alignedProxyProgram.programId, new PublicKey(streamPubKey)));
|
|
836
|
-
const alignedProxyAccounts = await this.
|
|
840
|
+
const alignedProxyAccounts = await this.connection.getMultipleAccountsInfo(alignedProxyPDAs);
|
|
837
841
|
alignedProxyAccounts.forEach((account, index) => {
|
|
838
|
-
if (account) {
|
|
842
|
+
if (account && account.data.length === ALIGNED_METADATA_ACC_SIZE) {
|
|
839
843
|
const alignedData = streamRecord[alignedStreamsPubKeys[index]];
|
|
840
|
-
streams[alignedStreamsPubKeys[index]] = new AlignedContract(alignedData, account);
|
|
844
|
+
streams[alignedStreamsPubKeys[index]] = new AlignedContract(alignedData, this.alignedProxyProgram.account.contract.coder.accounts.decode("contract", account.data));
|
|
841
845
|
}
|
|
842
846
|
});
|
|
843
847
|
return streams;
|
|
@@ -109,6 +109,11 @@ export declare class AlignedContract extends Contract implements AlignedStream {
|
|
|
109
109
|
proxyAddress: string;
|
|
110
110
|
priceOracle: string | undefined;
|
|
111
111
|
oracleType: OracleTypeName;
|
|
112
|
+
initialAmountPerPeriod: BN;
|
|
113
|
+
initialPrice: number;
|
|
114
|
+
lastPrice: number;
|
|
115
|
+
lastAmountUpdateTime: number;
|
|
116
|
+
initialNetAmount: BN;
|
|
112
117
|
constructor(stream: DecodedStream, alignedProxy: AlignedUnlocksContract);
|
|
113
118
|
}
|
|
114
119
|
export interface DecodedStream {
|
package/dist/esm/solana/types.js
CHANGED
|
@@ -113,6 +113,11 @@ export class AlignedContract extends Contract {
|
|
|
113
113
|
proxyAddress;
|
|
114
114
|
priceOracle;
|
|
115
115
|
oracleType;
|
|
116
|
+
initialAmountPerPeriod;
|
|
117
|
+
initialPrice;
|
|
118
|
+
lastPrice;
|
|
119
|
+
lastAmountUpdateTime;
|
|
120
|
+
initialNetAmount;
|
|
116
121
|
constructor(stream, alignedProxy) {
|
|
117
122
|
super(stream);
|
|
118
123
|
this.minPrice = getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
@@ -125,6 +130,11 @@ export class AlignedContract extends Contract {
|
|
|
125
130
|
this.sender = alignedProxy.sender.toBase58();
|
|
126
131
|
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
|
|
127
132
|
this.proxyAddress = stream.sender.toBase58();
|
|
133
|
+
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
|
|
134
|
+
this.initialPrice = getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
135
|
+
this.lastPrice = getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
|
|
136
|
+
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
|
|
137
|
+
this.initialNetAmount = alignedProxy.initialNetAmount;
|
|
128
138
|
// need to call this again since minPrice and maxPrice are used in determining the type
|
|
129
139
|
this.type = buildStreamType(this);
|
|
130
140
|
this.isAligned = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/stream",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.14",
|
|
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",
|
|
@@ -8,29 +8,34 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/esm/index.d.ts",
|
|
11
12
|
"import": "./dist/esm/index.js",
|
|
12
|
-
"require": "./dist/cjs/index.js"
|
|
13
|
-
"types": "./dist/esm/index.d.ts"
|
|
13
|
+
"require": "./dist/cjs/index.js"
|
|
14
14
|
},
|
|
15
15
|
"./aptos": {
|
|
16
|
+
"types": "./dist/esm/aptos/index.d.ts",
|
|
16
17
|
"import": "./dist/esm/aptos/index.js",
|
|
17
|
-
"require": "./dist/cjs/aptos/index.js"
|
|
18
|
-
"types": "./dist/esm/aptos/index.d.ts"
|
|
18
|
+
"require": "./dist/cjs/aptos/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./evm": {
|
|
21
|
+
"types": "./dist/esm/evm/index.d.ts",
|
|
21
22
|
"import": "./dist/esm/evm/index.js",
|
|
22
|
-
"require": "./dist/cjs/evm/index.js"
|
|
23
|
-
|
|
23
|
+
"require": "./dist/cjs/evm/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./solana/idl/*": {
|
|
26
|
+
"types": "./dist/esm/solana/descriptor/*",
|
|
27
|
+
"import": "./dist/esm/solana/descriptor/*",
|
|
28
|
+
"require": "./dist/cjs/solana/descriptor/*"
|
|
24
29
|
},
|
|
25
30
|
"./solana": {
|
|
31
|
+
"types": "./dist/esm/solana/index.d.ts",
|
|
26
32
|
"import": "./dist/esm/solana/index.js",
|
|
27
|
-
"require": "./dist/cjs/solana/index.js"
|
|
28
|
-
"types": "./dist/esm/solana/index.d.ts"
|
|
33
|
+
"require": "./dist/cjs/solana/index.js"
|
|
29
34
|
},
|
|
30
35
|
"./sui": {
|
|
36
|
+
"types": "./dist/esm/sui/index.d.ts",
|
|
31
37
|
"import": "./dist/esm/sui/index.js",
|
|
32
|
-
"require": "./dist/cjs/sui/index.js"
|
|
33
|
-
"types": "./dist/esm/sui/index.d.ts"
|
|
38
|
+
"require": "./dist/cjs/sui/index.js"
|
|
34
39
|
}
|
|
35
40
|
},
|
|
36
41
|
"scripts": {
|
|
@@ -42,9 +47,9 @@
|
|
|
42
47
|
"lint": "eslint --fix .",
|
|
43
48
|
"prepublishOnly": "pnpm run lint && pnpm run test run && pnpm run build"
|
|
44
49
|
},
|
|
45
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "aa62587453c8ffbb8bb4297d6bf4fef7f9210e44",
|
|
46
51
|
"devDependencies": {
|
|
47
|
-
"@streamflow/eslint-config": "7.4.
|
|
52
|
+
"@streamflow/eslint-config": "7.4.14",
|
|
48
53
|
"@types/bn.js": "5.1.1",
|
|
49
54
|
"@types/ethereum-checksum-address": "^0.0.0",
|
|
50
55
|
"date-fns": "2.28.0",
|
|
@@ -59,7 +64,7 @@
|
|
|
59
64
|
"@solana/spl-token": "0.4.9",
|
|
60
65
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
61
66
|
"@solana/web3.js": "1.95.4",
|
|
62
|
-
"@streamflow/common": "7.4.
|
|
67
|
+
"@streamflow/common": "7.4.14",
|
|
63
68
|
"@suiet/wallet-kit": "^0.3.3",
|
|
64
69
|
"aptos": "1.21.0",
|
|
65
70
|
"bn.js": "5.2.1",
|