@zebec-network/zebec-stream-sdk 1.4.0 → 1.5.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.
@@ -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,11 @@ 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"];
943
+ writable: true;
944
+ signer: true;
945
+ },
946
+ {
947
+ name: "feePayer";
952
948
  writable: true;
953
949
  signer: true;
954
950
  },
@@ -957,7 +953,6 @@ export type ZebecStream = {
957
953
  },
958
954
  {
959
955
  name: "receiverAta";
960
- docs: ["Receiver's Associated Token Account (ATA) for receiving stream_metadata tokens"];
961
956
  writable: true;
962
957
  pda: {
963
958
  seeds: [
@@ -1048,12 +1043,10 @@ export type ZebecStream = {
1048
1043
  },
1049
1044
  {
1050
1045
  name: "streamMetadata";
1051
- docs: ["Stream metadata loader, mutable because withdrawal updates state"];
1052
1046
  writable: true;
1053
1047
  },
1054
1048
  {
1055
1049
  name: "streamVault";
1056
- docs: ["Vault PDA holding the pooled stream_metadata tokens"];
1057
1050
  writable: true;
1058
1051
  pda: {
1059
1052
  seeds: [
@@ -1066,12 +1059,10 @@ export type ZebecStream = {
1066
1059
  },
1067
1060
  {
1068
1061
  name: "streamVaultAta";
1069
- docs: ["Token account owned by the vault that holds the tokens to withdraw"];
1070
1062
  writable: true;
1071
1063
  },
1072
1064
  {
1073
1065
  name: "streamConfig";
1074
- docs: ["Configuration account for the stream_metadata program"];
1075
1066
  pda: {
1076
1067
  seeds: [
1077
1068
  {
@@ -1083,11 +1074,9 @@ export type ZebecStream = {
1083
1074
  },
1084
1075
  {
1085
1076
  name: "streamToken";
1086
- docs: ["Mint info of the token being streamed"];
1087
1077
  },
1088
1078
  {
1089
1079
  name: "tokenProgram";
1090
- docs: ["Required Programs"];
1091
1080
  address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1092
1081
  },
1093
1082
  {
@@ -1315,14 +1304,6 @@ export type ZebecStream = {
1315
1304
  type: {
1316
1305
  kind: "struct";
1317
1306
  fields: [
1318
- {
1319
- name: "sender";
1320
- type: "pubkey";
1321
- },
1322
- {
1323
- name: "receiver";
1324
- type: "pubkey";
1325
- },
1326
1307
  {
1327
1308
  name: "amount";
1328
1309
  type: "u64";
@@ -1630,12 +1611,20 @@ export type ZebecStream = {
1630
1611
  type: "pubkey";
1631
1612
  },
1632
1613
  {
1633
- name: "creator";
1614
+ name: "sender";
1615
+ type: "pubkey";
1616
+ },
1617
+ {
1618
+ name: "receiver";
1634
1619
  type: "pubkey";
1635
1620
  },
1636
1621
  {
1637
1622
  name: "transactionFee";
1638
1623
  type: "u64";
1624
+ },
1625
+ {
1626
+ name: "tokenMint";
1627
+ type: "pubkey";
1639
1628
  }
1640
1629
  ];
1641
1630
  };
@@ -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,11 @@
702
694
  "accounts": [
703
695
  {
704
696
  "name": "withdrawer",
705
- "docs": ["The receiver of the stream_metadata tokens, must sign to authorize withdrawal"],
697
+ "writable": true,
698
+ "signer": true
699
+ },
700
+ {
701
+ "name": "fee_payer",
706
702
  "writable": true,
707
703
  "signer": true
708
704
  },
@@ -711,7 +707,6 @@
711
707
  },
712
708
  {
713
709
  "name": "receiver_ata",
714
- "docs": ["Receiver's Associated Token Account (ATA) for receiving stream_metadata tokens"],
715
710
  "writable": true,
716
711
  "pda": {
717
712
  "seeds": [
@@ -742,12 +737,10 @@
742
737
  },
743
738
  {
744
739
  "name": "stream_metadata",
745
- "docs": ["Stream metadata loader, mutable because withdrawal updates state"],
746
740
  "writable": true
747
741
  },
748
742
  {
749
743
  "name": "stream_vault",
750
- "docs": ["Vault PDA holding the pooled stream_metadata tokens"],
751
744
  "writable": true,
752
745
  "pda": {
753
746
  "seeds": [
@@ -760,12 +753,10 @@
760
753
  },
761
754
  {
762
755
  "name": "stream_vault_ata",
763
- "docs": ["Token account owned by the vault that holds the tokens to withdraw"],
764
756
  "writable": true
765
757
  },
766
758
  {
767
759
  "name": "stream_config",
768
- "docs": ["Configuration account for the stream_metadata program"],
769
760
  "pda": {
770
761
  "seeds": [
771
762
  {
@@ -776,12 +767,10 @@
776
767
  }
777
768
  },
778
769
  {
779
- "name": "stream_token",
780
- "docs": ["Mint info of the token being streamed"]
770
+ "name": "stream_token"
781
771
  },
782
772
  {
783
773
  "name": "token_program",
784
- "docs": ["Required Programs"],
785
774
  "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
786
775
  },
787
776
  {
@@ -1009,14 +998,6 @@
1009
998
  "type": {
1010
999
  "kind": "struct",
1011
1000
  "fields": [
1012
- {
1013
- "name": "sender",
1014
- "type": "pubkey"
1015
- },
1016
- {
1017
- "name": "receiver",
1018
- "type": "pubkey"
1019
- },
1020
1001
  {
1021
1002
  "name": "amount",
1022
1003
  "type": "u64"
@@ -1324,12 +1305,20 @@
1324
1305
  "type": "pubkey"
1325
1306
  },
1326
1307
  {
1327
- "name": "creator",
1308
+ "name": "sender",
1309
+ "type": "pubkey"
1310
+ },
1311
+ {
1312
+ "name": "receiver",
1328
1313
  "type": "pubkey"
1329
1314
  },
1330
1315
  {
1331
1316
  "name": "transaction_fee",
1332
1317
  "type": "u64"
1318
+ },
1319
+ {
1320
+ "name": "token_mint",
1321
+ "type": "pubkey"
1333
1322
  }
1334
1323
  ]
1335
1324
  }
@@ -44,7 +44,7 @@ export declare class ZebecStreamService {
44
44
  }): Promise<TransactionInstruction>;
45
45
  getPauseResumeStreamInstruction(streamMetadata: PublicKey, user: PublicKey): Promise<TransactionInstruction>;
46
46
  getCancelStreamInstruction(feePayer: PublicKey, otherParty: PublicKey, otherPartyAta: PublicKey, signer: PublicKey, signerAta: PublicKey, streamMetadata: PublicKey, streamToken: PublicKey, streamVault: PublicKey, streamVaultAta: PublicKey): Promise<TransactionInstruction>;
47
- getWithdrawStreamInstruction(receiver: PublicKey, receiverAta: PublicKey, streamMetadata: PublicKey, streamToken: PublicKey, streamVault: PublicKey, streamVaultAta: PublicKey, withdrawer: PublicKey): Promise<TransactionInstruction>;
47
+ getWithdrawStreamInstruction(receiver: PublicKey, receiverAta: PublicKey, streamMetadata: PublicKey, streamToken: PublicKey, streamVault: PublicKey, streamVaultAta: PublicKey, withdrawer: PublicKey, feePayer: PublicKey): Promise<TransactionInstruction>;
48
48
  getWhitelistTokensInstruction(admin: PublicKey, tokens: PublicKey[]): Promise<TransactionInstruction>;
49
49
  getChangeStreamReceiverInstruction(streamMetadata: PublicKey, newRecipient: PublicKey, signer: PublicKey): Promise<TransactionInstruction>;
50
50
  initializeStreamConfig(params: InitializeStreamConfigParams): Promise<TransactionPayload>;
@@ -111,6 +111,7 @@ export type PauseResumeStreamParams = {
111
111
  export type WithdrawStreamParams = {
112
112
  streamMetadata: Address;
113
113
  withdrawer?: Address;
114
+ feePayer?: Address;
114
115
  receiver: Address;
115
116
  };
116
117
  export type WhiteListTokensParams = {
@@ -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,
@@ -141,7 +139,7 @@ class ZebecStreamService {
141
139
  })
142
140
  .instruction();
143
141
  }
144
- getWithdrawStreamInstruction(receiver, receiverAta, streamMetadata, streamToken, streamVault, streamVaultAta, withdrawer) {
142
+ getWithdrawStreamInstruction(receiver, receiverAta, streamMetadata, streamToken, streamVault, streamVaultAta, withdrawer, feePayer) {
145
143
  return this.program.methods
146
144
  .withdrawStream()
147
145
  .accountsPartial({
@@ -152,6 +150,7 @@ class ZebecStreamService {
152
150
  receiver,
153
151
  receiverAta,
154
152
  withdrawer,
153
+ feePayer,
155
154
  })
156
155
  .instruction();
157
156
  }
@@ -283,13 +282,14 @@ class ZebecStreamService {
283
282
  async withdrawStream(params) {
284
283
  const receiver = (0, anchor_1.translateAddress)(params.receiver);
285
284
  const withdrawer = params.withdrawer ? (0, anchor_1.translateAddress)(params.withdrawer) : receiver;
285
+ const feePayer = params.feePayer ? (0, anchor_1.translateAddress)(params.feePayer) : params.withdrawer ? withdrawer : receiver;
286
286
  const streamMetadata = (0, anchor_1.translateAddress)(params.streamMetadata);
287
287
  const streamMetadataAccount = await this.program.account.paymentStream.fetch(streamMetadata);
288
288
  const streamToken = streamMetadataAccount.financials.streamToken;
289
289
  const receiverAta = (0, solana_common_1.getAssociatedTokenAddressSync)(streamToken, receiver, true);
290
290
  const [streamVault] = (0, pda_1.deriveStreamVaultPda)(streamMetadata, this.programId);
291
291
  const streamVaultAta = (0, solana_common_1.getAssociatedTokenAddressSync)(streamToken, streamVault, true);
292
- const ix = await this.getWithdrawStreamInstruction(receiver, receiverAta, streamMetadata, streamToken, streamVault, streamVaultAta, withdrawer);
292
+ const ix = await this.getWithdrawStreamInstruction(receiver, receiverAta, streamMetadata, streamToken, streamVault, streamVaultAta, withdrawer, feePayer);
293
293
  return this._createPayload(withdrawer, [ix]);
294
294
  }
295
295
  async whiteListTokens(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebec-network/zebec-stream-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "This is an SDK for interacting with ZEBEC Stream Program in solana",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",