@unifiedflow/unified-flow-sdk 1.0.7 → 1.0.8

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/client.d.ts CHANGED
@@ -34,13 +34,13 @@ export declare class UnifiedFlowClient {
34
34
  unlockMilestone(streamPDA: PublicKey, milestoneIndex: number, onStatus?: (phase: TxProgressPhase) => void): Promise<{
35
35
  signature: string;
36
36
  }>;
37
- editMilestone(streamPDA: PublicKey, mint: PublicKey, milestoneIndex: number, newAmount: anchor.BN, onStatus?: (phase: TxProgressPhase) => void): Promise<{
37
+ editMilestone(streamPDA: PublicKey, milestoneIndex: number, newAmount: anchor.BN, onStatus?: (phase: TxProgressPhase) => void): Promise<{
38
38
  signature: string;
39
39
  }>;
40
40
  editCliff(streamPDA: PublicKey, newCliffTs: anchor.BN, onStatus?: (phase: TxProgressPhase) => void): Promise<{
41
41
  signature: string;
42
42
  }>;
43
- editLinear(streamPDA: PublicKey, mint: PublicKey, newEndTs: anchor.BN, topupAmount: anchor.BN, onStatus?: (phase: TxProgressPhase) => void): Promise<{
43
+ editLinear(streamPDA: PublicKey, newEndTs: anchor.BN, topupAmount: anchor.BN, onStatus?: (phase: TxProgressPhase) => void): Promise<{
44
44
  signature: string;
45
45
  }>;
46
46
  private _toKitInstruction;
package/dist/client.js CHANGED
@@ -237,10 +237,13 @@ class UnifiedFlowClient {
237
237
  return { signature };
238
238
  }
239
239
  // ─── editMilestone ──────────────────────────────────────────────────────────
240
- async editMilestone(streamPDA, mint, milestoneIndex, newAmount, onStatus) {
240
+ async editMilestone(streamPDA, milestoneIndex, newAmount, onStatus) {
241
241
  onStatus?.("wallet_approval");
242
242
  const creator = new web3_js_1.PublicKey(this.wallet.account.address.toString());
243
243
  const milestonePDA = (0, pda_1.getMilestonePDA)(streamPDA, milestoneIndex, this.program.programId)[0];
244
+ const programAny = this.program;
245
+ const streamState = await programAny.account.streamAccount.fetch(streamPDA);
246
+ const mint = streamState.mint;
244
247
  const vault = (0, pda_1.getVaultATA)(mint, streamPDA);
245
248
  const creatorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, creator, true);
246
249
  const anchorIx = await this.program.methods
@@ -249,7 +252,8 @@ class UnifiedFlowClient {
249
252
  creator,
250
253
  stream: streamPDA,
251
254
  milestone: milestonePDA,
252
- vault,
255
+ mint,
256
+ vault: streamState.vault,
253
257
  creatorTokenAccount,
254
258
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
255
259
  })
@@ -259,6 +263,7 @@ class UnifiedFlowClient {
259
263
  { address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
260
264
  { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
261
265
  { address: milestonePDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
266
+ { address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
262
267
  { address: vault.toBase58(), role: kit_1.AccountRole.WRITABLE },
263
268
  { address: creatorTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
264
269
  { address: spl_token_1.TOKEN_PROGRAM_ID.toBase58(), role: kit_1.AccountRole.READONLY },
@@ -275,19 +280,32 @@ class UnifiedFlowClient {
275
280
  onStatus?.("wallet_approval");
276
281
  const creator = new web3_js_1.PublicKey(this.wallet.account.address.toString());
277
282
  const config = this.getConfigPDA();
283
+ const programAny = this.program;
284
+ const streamState = await programAny.account.streamAccount.fetch(streamPDA);
285
+ const mint = streamState.mint;
286
+ const vault = (0, pda_1.getVaultATA)(mint, streamPDA);
287
+ const creatorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, creator, true);
278
288
  const anchorIx = await this.program.methods
279
289
  .editCliff(newCliffTs)
280
290
  .accounts({
281
291
  creator,
292
+ mint,
293
+ config: config,
282
294
  stream: streamPDA,
283
- config,
295
+ vault: vault,
296
+ creatorTokenAccount,
297
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
284
298
  })
285
299
  .instruction();
286
300
  const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash(this.commitment);
287
301
  const kitIx = this._toKitInstruction(anchorIx, [
288
302
  { address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
289
- { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
303
+ { address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
290
304
  { address: config.toBase58(), role: kit_1.AccountRole.READONLY },
305
+ { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
306
+ { address: vault.toBase58(), role: kit_1.AccountRole.WRITABLE },
307
+ { address: creatorTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
308
+ { address: spl_token_1.TOKEN_PROGRAM_ID.toBase58(), role: kit_1.AccountRole.READONLY },
291
309
  ]);
292
310
  const txMsg = this._buildTxMessage(kitIx, blockhash, lastValidBlockHeight);
293
311
  onStatus?.("sending");
@@ -297,19 +315,23 @@ class UnifiedFlowClient {
297
315
  return { signature };
298
316
  }
299
317
  // ─── editLinear ─────────────────────────────────────────────────────────────
300
- async editLinear(streamPDA, mint, newEndTs, topupAmount, onStatus) {
318
+ async editLinear(streamPDA, newEndTs, topupAmount, onStatus) {
301
319
  onStatus?.("wallet_approval");
302
320
  const creator = new web3_js_1.PublicKey(this.wallet.account.address.toString());
303
321
  const config = this.getConfigPDA();
322
+ const programAny = this.program;
323
+ const streamState = await programAny.account.streamAccount.fetch(streamPDA);
324
+ const mint = streamState.mint;
304
325
  const vault = (0, pda_1.getVaultATA)(mint, streamPDA);
305
326
  const creatorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, creator, true);
306
327
  const anchorIx = await this.program.methods
307
328
  .editLinear(newEndTs, topupAmount)
308
329
  .accounts({
309
330
  creator,
331
+ mint,
332
+ config: config,
310
333
  stream: streamPDA,
311
- config,
312
- vault,
334
+ vault: streamState.vault,
313
335
  creatorTokenAccount,
314
336
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
315
337
  })
@@ -317,8 +339,9 @@ class UnifiedFlowClient {
317
339
  const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash(this.commitment);
318
340
  const kitIx = this._toKitInstruction(anchorIx, [
319
341
  { address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
320
- { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
342
+ { address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
321
343
  { address: config.toBase58(), role: kit_1.AccountRole.READONLY },
344
+ { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
322
345
  { address: vault.toBase58(), role: kit_1.AccountRole.WRITABLE },
323
346
  { address: creatorTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
324
347
  { address: spl_token_1.TOKEN_PROGRAM_ID.toBase58(), role: kit_1.AccountRole.READONLY },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifiedflow/unified-flow-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "SDK for the Unified Flow program",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",