@zebec-network/zebec-stream-sdk 1.3.1 → 1.4.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.
|
@@ -63,7 +63,6 @@ export type ZebecStream = {
|
|
|
63
63
|
accounts: [
|
|
64
64
|
{
|
|
65
65
|
name: "signer";
|
|
66
|
-
docs: ["The sender or authorized party who initiated the stream, must be signer"];
|
|
67
66
|
writable: true;
|
|
68
67
|
signer: true;
|
|
69
68
|
},
|
|
@@ -74,7 +73,6 @@ export type ZebecStream = {
|
|
|
74
73
|
},
|
|
75
74
|
{
|
|
76
75
|
name: "otherPartyAta";
|
|
77
|
-
docs: ["Receiver's associated token account (auto-created if needed)"];
|
|
78
76
|
writable: true;
|
|
79
77
|
pda: {
|
|
80
78
|
seeds: [
|
|
@@ -169,12 +167,10 @@ export type ZebecStream = {
|
|
|
169
167
|
},
|
|
170
168
|
{
|
|
171
169
|
name: "streamMetadata";
|
|
172
|
-
docs: ["Stream payment metadata, mutable because cancellation updates state"];
|
|
173
170
|
writable: true;
|
|
174
171
|
},
|
|
175
172
|
{
|
|
176
173
|
name: "streamVault";
|
|
177
|
-
docs: ["Vault PDA holding stream tokens"];
|
|
178
174
|
writable: true;
|
|
179
175
|
pda: {
|
|
180
176
|
seeds: [
|
|
@@ -187,21 +183,17 @@ export type ZebecStream = {
|
|
|
187
183
|
},
|
|
188
184
|
{
|
|
189
185
|
name: "streamVaultAta";
|
|
190
|
-
docs: ["Token account owned by the vault holding tokens for the stream"];
|
|
191
186
|
writable: true;
|
|
192
187
|
},
|
|
193
188
|
{
|
|
194
189
|
name: "signerAta";
|
|
195
|
-
docs: ["Sender's token account to receive refunded tokens on cancel"];
|
|
196
190
|
writable: true;
|
|
197
191
|
},
|
|
198
192
|
{
|
|
199
193
|
name: "streamToken";
|
|
200
|
-
docs: ["Mint of the stream token"];
|
|
201
194
|
},
|
|
202
195
|
{
|
|
203
196
|
name: "tokenProgram";
|
|
204
|
-
docs: ["Required Programs"];
|
|
205
197
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
206
198
|
},
|
|
207
199
|
{
|
|
@@ -948,7 +940,6 @@ export type ZebecStream = {
|
|
|
948
940
|
accounts: [
|
|
949
941
|
{
|
|
950
942
|
name: "withdrawer";
|
|
951
|
-
docs: ["The receiver of the stream_metadata tokens, must sign to authorize withdrawal"];
|
|
952
943
|
writable: true;
|
|
953
944
|
signer: true;
|
|
954
945
|
},
|
|
@@ -957,7 +948,6 @@ export type ZebecStream = {
|
|
|
957
948
|
},
|
|
958
949
|
{
|
|
959
950
|
name: "receiverAta";
|
|
960
|
-
docs: ["Receiver's Associated Token Account (ATA) for receiving stream_metadata tokens"];
|
|
961
951
|
writable: true;
|
|
962
952
|
pda: {
|
|
963
953
|
seeds: [
|
|
@@ -1048,12 +1038,10 @@ export type ZebecStream = {
|
|
|
1048
1038
|
},
|
|
1049
1039
|
{
|
|
1050
1040
|
name: "streamMetadata";
|
|
1051
|
-
docs: ["Stream metadata loader, mutable because withdrawal updates state"];
|
|
1052
1041
|
writable: true;
|
|
1053
1042
|
},
|
|
1054
1043
|
{
|
|
1055
1044
|
name: "streamVault";
|
|
1056
|
-
docs: ["Vault PDA holding the pooled stream_metadata tokens"];
|
|
1057
1045
|
writable: true;
|
|
1058
1046
|
pda: {
|
|
1059
1047
|
seeds: [
|
|
@@ -1066,12 +1054,10 @@ export type ZebecStream = {
|
|
|
1066
1054
|
},
|
|
1067
1055
|
{
|
|
1068
1056
|
name: "streamVaultAta";
|
|
1069
|
-
docs: ["Token account owned by the vault that holds the tokens to withdraw"];
|
|
1070
1057
|
writable: true;
|
|
1071
1058
|
},
|
|
1072
1059
|
{
|
|
1073
1060
|
name: "streamConfig";
|
|
1074
|
-
docs: ["Configuration account for the stream_metadata program"];
|
|
1075
1061
|
pda: {
|
|
1076
1062
|
seeds: [
|
|
1077
1063
|
{
|
|
@@ -1083,11 +1069,9 @@ export type ZebecStream = {
|
|
|
1083
1069
|
},
|
|
1084
1070
|
{
|
|
1085
1071
|
name: "streamToken";
|
|
1086
|
-
docs: ["Mint info of the token being streamed"];
|
|
1087
1072
|
},
|
|
1088
1073
|
{
|
|
1089
1074
|
name: "tokenProgram";
|
|
1090
|
-
docs: ["Required Programs"];
|
|
1091
1075
|
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1092
1076
|
},
|
|
1093
1077
|
{
|
|
@@ -1315,14 +1299,6 @@ export type ZebecStream = {
|
|
|
1315
1299
|
type: {
|
|
1316
1300
|
kind: "struct";
|
|
1317
1301
|
fields: [
|
|
1318
|
-
{
|
|
1319
|
-
name: "sender";
|
|
1320
|
-
type: "pubkey";
|
|
1321
|
-
},
|
|
1322
|
-
{
|
|
1323
|
-
name: "receiver";
|
|
1324
|
-
type: "pubkey";
|
|
1325
|
-
},
|
|
1326
1302
|
{
|
|
1327
1303
|
name: "amount";
|
|
1328
1304
|
type: "u64";
|
|
@@ -1630,12 +1606,20 @@ export type ZebecStream = {
|
|
|
1630
1606
|
type: "pubkey";
|
|
1631
1607
|
},
|
|
1632
1608
|
{
|
|
1633
|
-
name: "
|
|
1609
|
+
name: "sender";
|
|
1610
|
+
type: "pubkey";
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
name: "receiver";
|
|
1634
1614
|
type: "pubkey";
|
|
1635
1615
|
},
|
|
1636
1616
|
{
|
|
1637
1617
|
name: "transactionFee";
|
|
1638
1618
|
type: "u64";
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
name: "tokenMint";
|
|
1622
|
+
type: "pubkey";
|
|
1639
1623
|
}
|
|
1640
1624
|
];
|
|
1641
1625
|
};
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"accounts": [
|
|
58
58
|
{
|
|
59
59
|
"name": "signer",
|
|
60
|
-
"docs": ["The sender or authorized party who initiated the stream, must be signer"],
|
|
61
60
|
"writable": true,
|
|
62
61
|
"signer": true
|
|
63
62
|
},
|
|
@@ -68,7 +67,6 @@
|
|
|
68
67
|
},
|
|
69
68
|
{
|
|
70
69
|
"name": "other_party_ata",
|
|
71
|
-
"docs": ["Receiver's associated token account (auto-created if needed)"],
|
|
72
70
|
"writable": true,
|
|
73
71
|
"pda": {
|
|
74
72
|
"seeds": [
|
|
@@ -103,12 +101,10 @@
|
|
|
103
101
|
},
|
|
104
102
|
{
|
|
105
103
|
"name": "stream_metadata",
|
|
106
|
-
"docs": ["Stream payment metadata, mutable because cancellation updates state"],
|
|
107
104
|
"writable": true
|
|
108
105
|
},
|
|
109
106
|
{
|
|
110
107
|
"name": "stream_vault",
|
|
111
|
-
"docs": ["Vault PDA holding stream tokens"],
|
|
112
108
|
"writable": true,
|
|
113
109
|
"pda": {
|
|
114
110
|
"seeds": [
|
|
@@ -121,21 +117,17 @@
|
|
|
121
117
|
},
|
|
122
118
|
{
|
|
123
119
|
"name": "stream_vault_ata",
|
|
124
|
-
"docs": ["Token account owned by the vault holding tokens for the stream"],
|
|
125
120
|
"writable": true
|
|
126
121
|
},
|
|
127
122
|
{
|
|
128
123
|
"name": "signer_ata",
|
|
129
|
-
"docs": ["Sender's token account to receive refunded tokens on cancel"],
|
|
130
124
|
"writable": true
|
|
131
125
|
},
|
|
132
126
|
{
|
|
133
|
-
"name": "stream_token"
|
|
134
|
-
"docs": ["Mint of the stream token"]
|
|
127
|
+
"name": "stream_token"
|
|
135
128
|
},
|
|
136
129
|
{
|
|
137
130
|
"name": "token_program",
|
|
138
|
-
"docs": ["Required Programs"],
|
|
139
131
|
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
140
132
|
},
|
|
141
133
|
{
|
|
@@ -702,7 +694,6 @@
|
|
|
702
694
|
"accounts": [
|
|
703
695
|
{
|
|
704
696
|
"name": "withdrawer",
|
|
705
|
-
"docs": ["The receiver of the stream_metadata tokens, must sign to authorize withdrawal"],
|
|
706
697
|
"writable": true,
|
|
707
698
|
"signer": true
|
|
708
699
|
},
|
|
@@ -711,7 +702,6 @@
|
|
|
711
702
|
},
|
|
712
703
|
{
|
|
713
704
|
"name": "receiver_ata",
|
|
714
|
-
"docs": ["Receiver's Associated Token Account (ATA) for receiving stream_metadata tokens"],
|
|
715
705
|
"writable": true,
|
|
716
706
|
"pda": {
|
|
717
707
|
"seeds": [
|
|
@@ -742,12 +732,10 @@
|
|
|
742
732
|
},
|
|
743
733
|
{
|
|
744
734
|
"name": "stream_metadata",
|
|
745
|
-
"docs": ["Stream metadata loader, mutable because withdrawal updates state"],
|
|
746
735
|
"writable": true
|
|
747
736
|
},
|
|
748
737
|
{
|
|
749
738
|
"name": "stream_vault",
|
|
750
|
-
"docs": ["Vault PDA holding the pooled stream_metadata tokens"],
|
|
751
739
|
"writable": true,
|
|
752
740
|
"pda": {
|
|
753
741
|
"seeds": [
|
|
@@ -760,12 +748,10 @@
|
|
|
760
748
|
},
|
|
761
749
|
{
|
|
762
750
|
"name": "stream_vault_ata",
|
|
763
|
-
"docs": ["Token account owned by the vault that holds the tokens to withdraw"],
|
|
764
751
|
"writable": true
|
|
765
752
|
},
|
|
766
753
|
{
|
|
767
754
|
"name": "stream_config",
|
|
768
|
-
"docs": ["Configuration account for the stream_metadata program"],
|
|
769
755
|
"pda": {
|
|
770
756
|
"seeds": [
|
|
771
757
|
{
|
|
@@ -776,12 +762,10 @@
|
|
|
776
762
|
}
|
|
777
763
|
},
|
|
778
764
|
{
|
|
779
|
-
"name": "stream_token"
|
|
780
|
-
"docs": ["Mint info of the token being streamed"]
|
|
765
|
+
"name": "stream_token"
|
|
781
766
|
},
|
|
782
767
|
{
|
|
783
768
|
"name": "token_program",
|
|
784
|
-
"docs": ["Required Programs"],
|
|
785
769
|
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
786
770
|
},
|
|
787
771
|
{
|
|
@@ -1009,14 +993,6 @@
|
|
|
1009
993
|
"type": {
|
|
1010
994
|
"kind": "struct",
|
|
1011
995
|
"fields": [
|
|
1012
|
-
{
|
|
1013
|
-
"name": "sender",
|
|
1014
|
-
"type": "pubkey"
|
|
1015
|
-
},
|
|
1016
|
-
{
|
|
1017
|
-
"name": "receiver",
|
|
1018
|
-
"type": "pubkey"
|
|
1019
|
-
},
|
|
1020
996
|
{
|
|
1021
997
|
"name": "amount",
|
|
1022
998
|
"type": "u64"
|
|
@@ -1324,12 +1300,20 @@
|
|
|
1324
1300
|
"type": "pubkey"
|
|
1325
1301
|
},
|
|
1326
1302
|
{
|
|
1327
|
-
"name": "
|
|
1303
|
+
"name": "sender",
|
|
1304
|
+
"type": "pubkey"
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
"name": "receiver",
|
|
1328
1308
|
"type": "pubkey"
|
|
1329
1309
|
},
|
|
1330
1310
|
{
|
|
1331
1311
|
"name": "transaction_fee",
|
|
1332
1312
|
"type": "u64"
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
"name": "token_mint",
|
|
1316
|
+
"type": "pubkey"
|
|
1333
1317
|
}
|
|
1334
1318
|
]
|
|
1335
1319
|
}
|
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
|
+
};
|
|
@@ -96,8 +96,6 @@ class ZebecStreamService {
|
|
|
96
96
|
duration: streamData.duration,
|
|
97
97
|
isPausable: Number(streamData.isPausable),
|
|
98
98
|
rateUpdatable: Number(streamData.rateUpdatable),
|
|
99
|
-
receiver,
|
|
100
|
-
sender,
|
|
101
99
|
startNow: Number(streamData.startNow),
|
|
102
100
|
startTime: streamData.startTime,
|
|
103
101
|
streamFrequency: streamData.autoWithdrawFrequency,
|
|
@@ -218,7 +216,7 @@ class ZebecStreamService {
|
|
|
218
216
|
const streamConfigAccount = await this.program.account.streamConfig.fetch(streamConfig);
|
|
219
217
|
const withdrawer = streamConfigAccount.withdrawAccount;
|
|
220
218
|
const autoWithdrawFrequencies = new Set(Array.from(streamConfigAccount.frequencies.map((f) => f.toNumber())));
|
|
221
|
-
if (!autoWithdrawFrequencies.has(params.autoWithdrawFrequency)) {
|
|
219
|
+
if (params.automaticWithdrawal && !autoWithdrawFrequencies.has(params.autoWithdrawFrequency)) {
|
|
222
220
|
throw new Error("Invalid stream frequency");
|
|
223
221
|
}
|
|
224
222
|
const senderAta = (0, solana_common_1.getAssociatedTokenAddressSync)(streamToken, sender, true);
|
|
@@ -307,8 +305,10 @@ class ZebecStreamService {
|
|
|
307
305
|
}
|
|
308
306
|
async getStreamConfigInfo(commitment) {
|
|
309
307
|
const [config] = (0, pda_1.deriveStreamConfigPda)(this.programId);
|
|
308
|
+
console.log("config:", config.toString());
|
|
310
309
|
const configInfo = await this.program.account.streamConfig.fetch(config, commitment ?? this.connection.commitment);
|
|
311
310
|
return {
|
|
311
|
+
address: config,
|
|
312
312
|
admin: configInfo.admin,
|
|
313
313
|
withdrawerAccount: configInfo.withdrawAccount,
|
|
314
314
|
whitelistedTokens: configInfo.whitelistedTokens,
|
|
@@ -330,6 +330,7 @@ class ZebecStreamService {
|
|
|
330
330
|
.toFixed();
|
|
331
331
|
const cliffPercentage = Number((0, core_utils_1.bpsToPercent)(metadataInfo.financials.cliffPercentage.toNumber()));
|
|
332
332
|
return {
|
|
333
|
+
address: (0, anchor_1.translateAddress)(streamMetadata),
|
|
333
334
|
parties: {
|
|
334
335
|
sender: metadataInfo.parties.sender,
|
|
335
336
|
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;
|