@streamflow/staking 7.4.13 → 7.4.15

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 CHANGED
@@ -99,7 +99,7 @@ const maxDuration = new BN(2592000);
99
99
  /*
100
100
  1 day - Unix time in seconds
101
101
  */
102
- const maxDuration = new BN(86400);
102
+ const minDuration = new BN(86400);
103
103
  /*
104
104
  Limits signers that can create/assign reward pools to this stake pool. True - anyone can
105
105
  */
@@ -245,6 +245,34 @@ await client.claimRewards({
245
245
  > For instance, prepareClaimRewardsInstructions.
246
246
  > These APIs allow to aggregate multiple operations in a single transaction according to the app needs.
247
247
 
248
+ ### Set Token Metadata
249
+
250
+ SolanaStakingClient also exposes original IDL of all programs, so you can use some additional instructions, that are not wrapped by the client. Currently there is no method to update Token Metadata of the Staking Mint that stakers get in return for their stake, but you can call the instructions from the original IDL like so:
251
+
252
+ ```typescript
253
+ // Stake Mint Token Program matches token program of the original token, program exposes separate methods depending on the program.
254
+ import { signAndExecuteTransaction, prepareTransaction } from "@streamflow/common/solana";
255
+
256
+ const program = client.programs.stakePoolProgram;
257
+
258
+ // for SPL
259
+ let ix = await program.methods.setTokenMetadataSpl("sToken", "sTST", "https://arweave.net/VVrrcRaOYombRAzWrcDLiV5hVmQUfvp1nS8nfttQvBE").accounts({
260
+ stakePool: metadataId
261
+ }).accountsPartial({
262
+ authority: keypair.publicKey
263
+ }).instruction();
264
+ // for Token22
265
+ ix = await program.methods.setTokenMetadataT22("sToken", "sTST", "https://arweave.net/VVrrcRaOYombRAzWrcDLiV5hVmQUfvp1nS8nfttQvBE").accounts({
266
+ stakePool: metadataId
267
+ }).accountsPartial({
268
+ authority: keypair.publicKey
269
+ }).instruction();
270
+
271
+ const { tx, hash, context } = await prepareTransaction(client.connection, [ix], keypair.publicKey);
272
+ const sig = await signAndExecuteTransaction(client.connection, keypair, tx, { hash, context }, {});
273
+ console.log(sig);
274
+ ```
275
+
248
276
  ## Appendix
249
277
 
250
278
  Streamflow Staking protocol program IDs
@@ -106,7 +106,7 @@ class SolanaStakingClient {
106
106
  const creator = extParams.invoker.publicKey;
107
107
  (0, common_1.invariant)(creator, "Undefined invoker publicKey");
108
108
  const createInstruction = await stakePoolProgram.methods
109
- .createPool(nonce, maxWeight, minDuration, maxDuration, permissionless)
109
+ .createPool(nonce, maxWeight, minDuration, maxDuration, permissionless, null, null)
110
110
  .accounts({
111
111
  creator,
112
112
  mint,
@@ -9,7 +9,16 @@
9
9
  "instructions": [
10
10
  {
11
11
  "name": "change_authority",
12
- "discriminator": [50, 106, 66, 104, 99, 118, 145, 88],
12
+ "discriminator": [
13
+ 50,
14
+ 106,
15
+ 66,
16
+ 104,
17
+ 99,
18
+ 118,
19
+ 145,
20
+ 88
21
+ ],
13
22
  "accounts": [
14
23
  {
15
24
  "name": "config",
@@ -18,14 +27,23 @@
18
27
  "seeds": [
19
28
  {
20
29
  "kind": "const",
21
- "value": [99, 111, 110, 102, 105, 103]
30
+ "value": [
31
+ 99,
32
+ 111,
33
+ 110,
34
+ 102,
35
+ 105,
36
+ 103
37
+ ]
22
38
  }
23
39
  ]
24
40
  }
25
41
  },
26
42
  {
27
43
  "name": "authority",
28
- "docs": ["authority"],
44
+ "docs": [
45
+ "authority"
46
+ ],
29
47
  "signer": true
30
48
  },
31
49
  {
@@ -36,7 +54,16 @@
36
54
  },
37
55
  {
38
56
  "name": "initialize",
39
- "discriminator": [175, 175, 109, 31, 13, 152, 155, 237],
57
+ "discriminator": [
58
+ 175,
59
+ 175,
60
+ 109,
61
+ 31,
62
+ 13,
63
+ 152,
64
+ 155,
65
+ 237
66
+ ],
40
67
  "accounts": [
41
68
  {
42
69
  "name": "config",
@@ -45,14 +72,23 @@
45
72
  "seeds": [
46
73
  {
47
74
  "kind": "const",
48
- "value": [99, 111, 110, 102, 105, 103]
75
+ "value": [
76
+ 99,
77
+ 111,
78
+ 110,
79
+ 102,
80
+ 105,
81
+ 103
82
+ ]
49
83
  }
50
84
  ]
51
85
  }
52
86
  },
53
87
  {
54
88
  "name": "authority",
55
- "docs": ["authority"],
89
+ "docs": [
90
+ "authority"
91
+ ],
56
92
  "writable": true,
57
93
  "signer": true,
58
94
  "address": "ACYtYsL4KYtJzD53wqyifqad2D8224kamcngYPgSy3t"
@@ -66,7 +102,16 @@
66
102
  },
67
103
  {
68
104
  "name": "remove_fee",
69
- "discriminator": [190, 227, 105, 10, 30, 161, 81, 212],
105
+ "discriminator": [
106
+ 190,
107
+ 227,
108
+ 105,
109
+ 10,
110
+ 30,
111
+ 161,
112
+ 81,
113
+ 212
114
+ ],
70
115
  "accounts": [
71
116
  {
72
117
  "name": "fee_value",
@@ -75,7 +120,17 @@
75
120
  "seeds": [
76
121
  {
77
122
  "kind": "const",
78
- "value": [102, 101, 101, 45, 118, 97, 108, 117, 101]
123
+ "value": [
124
+ 102,
125
+ 101,
126
+ 101,
127
+ 45,
128
+ 118,
129
+ 97,
130
+ 108,
131
+ 117,
132
+ 101
133
+ ]
79
134
  },
80
135
  {
81
136
  "kind": "account",
@@ -90,14 +145,23 @@
90
145
  "seeds": [
91
146
  {
92
147
  "kind": "const",
93
- "value": [99, 111, 110, 102, 105, 103]
148
+ "value": [
149
+ 99,
150
+ 111,
151
+ 110,
152
+ 102,
153
+ 105,
154
+ 103
155
+ ]
94
156
  }
95
157
  ]
96
158
  }
97
159
  },
98
160
  {
99
161
  "name": "authority",
100
- "docs": ["authority"],
162
+ "docs": [
163
+ "authority"
164
+ ],
101
165
  "writable": true,
102
166
  "signer": true
103
167
  },
@@ -113,7 +177,16 @@
113
177
  },
114
178
  {
115
179
  "name": "update_config",
116
- "discriminator": [29, 158, 252, 191, 10, 83, 219, 99],
180
+ "discriminator": [
181
+ 29,
182
+ 158,
183
+ 252,
184
+ 191,
185
+ 10,
186
+ 83,
187
+ 219,
188
+ 99
189
+ ],
117
190
  "accounts": [
118
191
  {
119
192
  "name": "config",
@@ -122,14 +195,23 @@
122
195
  "seeds": [
123
196
  {
124
197
  "kind": "const",
125
- "value": [99, 111, 110, 102, 105, 103]
198
+ "value": [
199
+ 99,
200
+ 111,
201
+ 110,
202
+ 102,
203
+ 105,
204
+ 103
205
+ ]
126
206
  }
127
207
  ]
128
208
  }
129
209
  },
130
210
  {
131
211
  "name": "authority",
132
- "docs": ["authority"],
212
+ "docs": [
213
+ "authority"
214
+ ],
133
215
  "signer": true
134
216
  },
135
217
  {
@@ -148,7 +230,16 @@
148
230
  },
149
231
  {
150
232
  "name": "write_fee",
151
- "discriminator": [80, 12, 148, 143, 16, 120, 24, 48],
233
+ "discriminator": [
234
+ 80,
235
+ 12,
236
+ 148,
237
+ 143,
238
+ 16,
239
+ 120,
240
+ 24,
241
+ 48
242
+ ],
152
243
  "accounts": [
153
244
  {
154
245
  "name": "fee_value",
@@ -157,7 +248,17 @@
157
248
  "seeds": [
158
249
  {
159
250
  "kind": "const",
160
- "value": [102, 101, 101, 45, 118, 97, 108, 117, 101]
251
+ "value": [
252
+ 102,
253
+ 101,
254
+ 101,
255
+ 45,
256
+ 118,
257
+ 97,
258
+ 108,
259
+ 117,
260
+ 101
261
+ ]
161
262
  },
162
263
  {
163
264
  "kind": "account",
@@ -172,14 +273,23 @@
172
273
  "seeds": [
173
274
  {
174
275
  "kind": "const",
175
- "value": [99, 111, 110, 102, 105, 103]
276
+ "value": [
277
+ 99,
278
+ 111,
279
+ 110,
280
+ 102,
281
+ 105,
282
+ 103
283
+ ]
176
284
  }
177
285
  ]
178
286
  }
179
287
  },
180
288
  {
181
289
  "name": "authority",
182
- "docs": ["authority"],
290
+ "docs": [
291
+ "authority"
292
+ ],
183
293
  "writable": true,
184
294
  "signer": true
185
295
  },
@@ -202,11 +312,29 @@
202
312
  "accounts": [
203
313
  {
204
314
  "name": "Config",
205
- "discriminator": [155, 12, 170, 224, 30, 250, 204, 130]
315
+ "discriminator": [
316
+ 155,
317
+ 12,
318
+ 170,
319
+ 224,
320
+ 30,
321
+ 250,
322
+ 204,
323
+ 130
324
+ ]
206
325
  },
207
326
  {
208
327
  "name": "FeeValue",
209
- "discriminator": [10, 188, 89, 64, 4, 183, 231, 0]
328
+ "discriminator": [
329
+ 10,
330
+ 188,
331
+ 89,
332
+ 64,
333
+ 4,
334
+ 183,
335
+ 231,
336
+ 0
337
+ ]
210
338
  }
211
339
  ],
212
340
  "errors": [
@@ -229,33 +357,52 @@
229
357
  "fields": [
230
358
  {
231
359
  "name": "authority",
232
- "docs": ["Fee Manager authority"],
360
+ "docs": [
361
+ "Fee Manager authority"
362
+ ],
233
363
  "type": "pubkey"
234
364
  },
235
365
  {
236
366
  "name": "streamflow_fee",
237
- "docs": ["Default fee"],
367
+ "docs": [
368
+ "Default fee"
369
+ ],
238
370
  "type": "u64"
239
371
  },
240
372
  {
241
373
  "name": "_buffer_1",
242
- "docs": ["Buffer for additional fields"],
374
+ "docs": [
375
+ "Buffer for additional fields"
376
+ ],
243
377
  "type": {
244
- "array": ["u8", 64]
378
+ "array": [
379
+ "u8",
380
+ 64
381
+ ]
245
382
  }
246
383
  },
247
384
  {
248
385
  "name": "_buffer_2",
249
- "docs": ["Buffer for additional fields"],
386
+ "docs": [
387
+ "Buffer for additional fields"
388
+ ],
250
389
  "type": {
251
- "array": ["u8", 64]
390
+ "array": [
391
+ "u8",
392
+ 64
393
+ ]
252
394
  }
253
395
  },
254
396
  {
255
397
  "name": "_buffer_3",
256
- "docs": ["Buffer for additional fields"],
398
+ "docs": [
399
+ "Buffer for additional fields"
400
+ ],
257
401
  "type": {
258
- "array": ["u8", 64]
402
+ "array": [
403
+ "u8",
404
+ 64
405
+ ]
259
406
  }
260
407
  }
261
408
  ]
@@ -272,9 +419,14 @@
272
419
  },
273
420
  {
274
421
  "name": "_buffer",
275
- "docs": ["Buffer for additional fields"],
422
+ "docs": [
423
+ "Buffer for additional fields"
424
+ ],
276
425
  "type": {
277
- "array": ["u8", 64]
426
+ "array": [
427
+ "u8",
428
+ 64
429
+ ]
278
430
  }
279
431
  }
280
432
  ]