@zebec-network/zebec-stream-sdk 1.3.1 → 1.4.0
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/dist/constants.d.ts +1 -0
- package/dist/constants.js +5 -1
- package/dist/services/streamService.js +4 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export declare const STREAM_NAME_BUFFER_SIZE = 128;
|
|
|
2
2
|
export type Network = "mainnet-beta" | "devnet";
|
|
3
3
|
export declare const STREAM_PROGRAM_ID: Record<Network, string>;
|
|
4
4
|
export declare const ZTOKEN_PROGRAM_ID: Record<Network, string>;
|
|
5
|
+
export declare const STREAM_PROGRAM_LOOKUP_TABLE_ADDRESS: Record<Network, string>;
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZTOKEN_PROGRAM_ID = exports.STREAM_PROGRAM_ID = exports.STREAM_NAME_BUFFER_SIZE = void 0;
|
|
3
|
+
exports.STREAM_PROGRAM_LOOKUP_TABLE_ADDRESS = exports.ZTOKEN_PROGRAM_ID = exports.STREAM_PROGRAM_ID = exports.STREAM_NAME_BUFFER_SIZE = void 0;
|
|
4
4
|
exports.STREAM_NAME_BUFFER_SIZE = 128;
|
|
5
5
|
exports.STREAM_PROGRAM_ID = {
|
|
6
6
|
"mainnet-beta": "GoqwQ8CeFB3KEQgVQtnJzUAMz6zHMpCdeG785PD459W6",
|
|
@@ -10,3 +10,7 @@ exports.ZTOKEN_PROGRAM_ID = {
|
|
|
10
10
|
"mainnet-beta": "GoqwQ8CeFB3KEQgVQtnJzUAMz6zHMpCdeG785PD459W6",
|
|
11
11
|
devnet: "GoqwQ8CeFB3KEQgVQtnJzUAMz6zHMpCdeG785PD459W6",
|
|
12
12
|
};
|
|
13
|
+
exports.STREAM_PROGRAM_LOOKUP_TABLE_ADDRESS = {
|
|
14
|
+
devnet: "HJmEzSXzJrtSdgBZSaedQ51WaD4LkT1r5zR2yT1QERqv",
|
|
15
|
+
"mainnet-beta": "",
|
|
16
|
+
};
|
|
@@ -218,7 +218,7 @@ class ZebecStreamService {
|
|
|
218
218
|
const streamConfigAccount = await this.program.account.streamConfig.fetch(streamConfig);
|
|
219
219
|
const withdrawer = streamConfigAccount.withdrawAccount;
|
|
220
220
|
const autoWithdrawFrequencies = new Set(Array.from(streamConfigAccount.frequencies.map((f) => f.toNumber())));
|
|
221
|
-
if (!autoWithdrawFrequencies.has(params.autoWithdrawFrequency)) {
|
|
221
|
+
if (params.automaticWithdrawal && !autoWithdrawFrequencies.has(params.autoWithdrawFrequency)) {
|
|
222
222
|
throw new Error("Invalid stream frequency");
|
|
223
223
|
}
|
|
224
224
|
const senderAta = (0, solana_common_1.getAssociatedTokenAddressSync)(streamToken, sender, true);
|
|
@@ -307,8 +307,10 @@ class ZebecStreamService {
|
|
|
307
307
|
}
|
|
308
308
|
async getStreamConfigInfo(commitment) {
|
|
309
309
|
const [config] = (0, pda_1.deriveStreamConfigPda)(this.programId);
|
|
310
|
+
console.log("config:", config.toString());
|
|
310
311
|
const configInfo = await this.program.account.streamConfig.fetch(config, commitment ?? this.connection.commitment);
|
|
311
312
|
return {
|
|
313
|
+
address: config,
|
|
312
314
|
admin: configInfo.admin,
|
|
313
315
|
withdrawerAccount: configInfo.withdrawAccount,
|
|
314
316
|
whitelistedTokens: configInfo.whitelistedTokens,
|
|
@@ -330,6 +332,7 @@ class ZebecStreamService {
|
|
|
330
332
|
.toFixed();
|
|
331
333
|
const cliffPercentage = Number((0, core_utils_1.bpsToPercent)(metadataInfo.financials.cliffPercentage.toNumber()));
|
|
332
334
|
return {
|
|
335
|
+
address: (0, anchor_1.translateAddress)(streamMetadata),
|
|
333
336
|
parties: {
|
|
334
337
|
sender: metadataInfo.parties.sender,
|
|
335
338
|
receiver: metadataInfo.parties.receiver,
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
export type Numeric = string | number;
|
|
3
3
|
export type StreamConfigInfo = {
|
|
4
|
+
address: PublicKey;
|
|
4
5
|
admin: PublicKey;
|
|
5
6
|
withdrawerAccount: PublicKey;
|
|
6
7
|
whitelistedTokens: PublicKey[];
|
|
@@ -9,6 +10,7 @@ export type StreamConfigInfo = {
|
|
|
9
10
|
frequencies: number[];
|
|
10
11
|
};
|
|
11
12
|
export type StreamMetadataInfo = {
|
|
13
|
+
address: PublicKey;
|
|
12
14
|
parties: {
|
|
13
15
|
sender: PublicKey;
|
|
14
16
|
receiver: PublicKey;
|