@unifiedflow/unified-flow-sdk 1.0.6 → 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
@@ -178,24 +178,23 @@ class UnifiedFlowClient {
178
178
  const vault = (0, pda_1.getVaultATA)(mint, streamPDA);
179
179
  const anchorIx = await this.program.methods
180
180
  .cancel()
181
- .accountsStrict({
181
+ .accounts({
182
182
  creator,
183
- stream: streamPDA,
184
183
  mint,
185
- config,
186
- vault,
184
+ config: config,
185
+ stream: streamPDA,
186
+ vault: streamState.vault,
187
187
  creatorTokenAccount,
188
188
  recipientTokenAccount,
189
189
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
190
- systemProgram: web3_js_1.SystemProgram.programId,
191
190
  })
192
191
  .instruction();
193
192
  const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash(this.commitment);
194
193
  const kitIx = this._toKitInstruction(anchorIx, [
195
194
  { address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
196
- { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
197
195
  { address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
198
196
  { address: config.toBase58(), role: kit_1.AccountRole.READONLY },
197
+ { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
199
198
  { address: vault.toBase58(), role: kit_1.AccountRole.WRITABLE },
200
199
  { address: creatorTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
201
200
  { address: recipientTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
@@ -238,10 +237,13 @@ class UnifiedFlowClient {
238
237
  return { signature };
239
238
  }
240
239
  // ─── editMilestone ──────────────────────────────────────────────────────────
241
- async editMilestone(streamPDA, mint, milestoneIndex, newAmount, onStatus) {
240
+ async editMilestone(streamPDA, milestoneIndex, newAmount, onStatus) {
242
241
  onStatus?.("wallet_approval");
243
242
  const creator = new web3_js_1.PublicKey(this.wallet.account.address.toString());
244
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;
245
247
  const vault = (0, pda_1.getVaultATA)(mint, streamPDA);
246
248
  const creatorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, creator, true);
247
249
  const anchorIx = await this.program.methods
@@ -250,7 +252,8 @@ class UnifiedFlowClient {
250
252
  creator,
251
253
  stream: streamPDA,
252
254
  milestone: milestonePDA,
253
- vault,
255
+ mint,
256
+ vault: streamState.vault,
254
257
  creatorTokenAccount,
255
258
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
256
259
  })
@@ -260,6 +263,7 @@ class UnifiedFlowClient {
260
263
  { address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
261
264
  { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
262
265
  { address: milestonePDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
266
+ { address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
263
267
  { address: vault.toBase58(), role: kit_1.AccountRole.WRITABLE },
264
268
  { address: creatorTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
265
269
  { address: spl_token_1.TOKEN_PROGRAM_ID.toBase58(), role: kit_1.AccountRole.READONLY },
@@ -276,19 +280,32 @@ class UnifiedFlowClient {
276
280
  onStatus?.("wallet_approval");
277
281
  const creator = new web3_js_1.PublicKey(this.wallet.account.address.toString());
278
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);
279
288
  const anchorIx = await this.program.methods
280
289
  .editCliff(newCliffTs)
281
290
  .accounts({
282
291
  creator,
292
+ mint,
293
+ config: config,
283
294
  stream: streamPDA,
284
- config,
295
+ vault: vault,
296
+ creatorTokenAccount,
297
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
285
298
  })
286
299
  .instruction();
287
300
  const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash(this.commitment);
288
301
  const kitIx = this._toKitInstruction(anchorIx, [
289
302
  { address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
290
- { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
303
+ { address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
291
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 },
292
309
  ]);
293
310
  const txMsg = this._buildTxMessage(kitIx, blockhash, lastValidBlockHeight);
294
311
  onStatus?.("sending");
@@ -298,19 +315,23 @@ class UnifiedFlowClient {
298
315
  return { signature };
299
316
  }
300
317
  // ─── editLinear ─────────────────────────────────────────────────────────────
301
- async editLinear(streamPDA, mint, newEndTs, topupAmount, onStatus) {
318
+ async editLinear(streamPDA, newEndTs, topupAmount, onStatus) {
302
319
  onStatus?.("wallet_approval");
303
320
  const creator = new web3_js_1.PublicKey(this.wallet.account.address.toString());
304
321
  const config = this.getConfigPDA();
322
+ const programAny = this.program;
323
+ const streamState = await programAny.account.streamAccount.fetch(streamPDA);
324
+ const mint = streamState.mint;
305
325
  const vault = (0, pda_1.getVaultATA)(mint, streamPDA);
306
326
  const creatorTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, creator, true);
307
327
  const anchorIx = await this.program.methods
308
328
  .editLinear(newEndTs, topupAmount)
309
329
  .accounts({
310
330
  creator,
331
+ mint,
332
+ config: config,
311
333
  stream: streamPDA,
312
- config,
313
- vault,
334
+ vault: streamState.vault,
314
335
  creatorTokenAccount,
315
336
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
316
337
  })
@@ -318,8 +339,9 @@ class UnifiedFlowClient {
318
339
  const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash(this.commitment);
319
340
  const kitIx = this._toKitInstruction(anchorIx, [
320
341
  { address: creator.toBase58(), role: kit_1.AccountRole.WRITABLE_SIGNER, signer: this.kitSigner },
321
- { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
342
+ { address: mint.toBase58(), role: kit_1.AccountRole.READONLY },
322
343
  { address: config.toBase58(), role: kit_1.AccountRole.READONLY },
344
+ { address: streamPDA.toBase58(), role: kit_1.AccountRole.WRITABLE },
323
345
  { address: vault.toBase58(), role: kit_1.AccountRole.WRITABLE },
324
346
  { address: creatorTokenAccount.toBase58(), role: kit_1.AccountRole.WRITABLE },
325
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.6",
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",