@streamflow/stream 7.0.0-alpha.12 → 7.0.0-alpha.14

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.
Files changed (37) hide show
  1. package/README.md +10 -5
  2. package/dist/cjs/common/constants.js +2 -1
  3. package/dist/cjs/common/contractUtils.js +17 -1
  4. package/dist/cjs/common/types.js +30 -1
  5. package/dist/cjs/solana/StreamClient.js +290 -139
  6. package/dist/cjs/solana/constants.js +29 -1
  7. package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
  8. package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +2 -0
  9. package/dist/cjs/solana/index.js +2 -1
  10. package/dist/cjs/solana/lib/derive-accounts.js +17 -0
  11. package/dist/cjs/solana/{utils.js → lib/utils.js} +2 -2
  12. package/dist/cjs/solana/types.js +25 -2
  13. package/dist/esm/aptos/types.d.ts +2 -2
  14. package/dist/esm/common/constants.d.ts +1 -0
  15. package/dist/esm/common/constants.js +1 -0
  16. package/dist/esm/common/contractUtils.d.ts +4 -1
  17. package/dist/esm/common/contractUtils.js +13 -0
  18. package/dist/esm/common/types.d.ts +104 -49
  19. package/dist/esm/common/types.js +29 -0
  20. package/dist/esm/evm/types.d.ts +2 -2
  21. package/dist/esm/solana/StreamClient.d.ts +22 -16
  22. package/dist/esm/solana/StreamClient.js +293 -141
  23. package/dist/esm/solana/constants.d.ts +14 -0
  24. package/dist/esm/solana/constants.js +29 -1
  25. package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
  26. package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +1272 -0
  27. package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +1 -0
  28. package/dist/esm/solana/index.d.ts +2 -1
  29. package/dist/esm/solana/index.js +2 -1
  30. package/dist/esm/solana/lib/derive-accounts.d.ts +4 -0
  31. package/dist/esm/solana/lib/derive-accounts.js +11 -0
  32. package/dist/esm/solana/{utils.d.ts → lib/utils.d.ts} +1 -1
  33. package/dist/esm/solana/{utils.js → lib/utils.js} +2 -2
  34. package/dist/esm/solana/types.d.ts +31 -3
  35. package/dist/esm/solana/types.js +30 -2
  36. package/dist/esm/sui/types.d.ts +2 -2
  37. package/package.json +5 -4
@@ -34,14 +34,19 @@ const spl_token_1 = require("@solana/spl-token");
34
34
  const web3_js_1 = require("@solana/web3.js");
35
35
  const solana_1 = require("@streamflow/common/solana");
36
36
  const borsh = __importStar(require("borsh"));
37
+ const anchor_1 = require("@coral-xyz/anchor");
38
+ const common_1 = require("@streamflow/common");
37
39
  const types_js_1 = require("./types.js");
38
- const utils_js_1 = require("./utils.js");
40
+ const utils_js_1 = require("./lib/utils.js");
39
41
  const constants_js_1 = require("./constants.js");
40
42
  const instructions_js_1 = require("./instructions.js");
41
43
  const types_js_2 = require("../common/types.js");
42
44
  const BaseStreamClient_js_1 = require("../common/BaseStreamClient.js");
43
45
  const utils_js_2 = require("../common/utils.js");
44
46
  const constants_js_2 = require("../common/constants.js");
47
+ const streamflow_aligned_unlocks_json_1 = __importDefault(require("./descriptor/idl/streamflow_aligned_unlocks.json"));
48
+ const derive_accounts_js_1 = require("./lib/derive-accounts.js");
49
+ const contractUtils_js_1 = require("../common/contractUtils.js");
45
50
  const METADATA_ACC_SIZE = 1104;
46
51
  class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
47
52
  /**
@@ -53,6 +58,11 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
53
58
  this.connection = new web3_js_1.Connection(clusterUrl, this.commitment);
54
59
  this.programId = programId !== "" ? new web3_js_1.PublicKey(programId) : new web3_js_1.PublicKey(constants_js_1.PROGRAM_ID[cluster]);
55
60
  this.sendThrottler = sendThrottler ?? (0, solana_1.buildSendThrottler)(sendRate);
61
+ const alignedUnlocksProgram = {
62
+ ...streamflow_aligned_unlocks_json_1.default,
63
+ address: streamflow_aligned_unlocks_json_1.default.address,
64
+ };
65
+ this.alignedProxyProgram = new anchor_1.Program(alignedUnlocksProgram, { connection: this.connection });
56
66
  }
57
67
  getConnection() {
58
68
  return this.connection;
@@ -68,7 +78,23 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
68
78
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
69
79
  */
70
80
  async create(data, extParams) {
71
- const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(data, extParams);
81
+ const { partner, amount } = data;
82
+ const { isNative, sender } = extParams;
83
+ const partnerPublicKey = partner ? new web3_js_1.PublicKey(partner) : constants_js_1.WITHDRAWOR_PUBLIC_KEY;
84
+ const mintPublicKey = new web3_js_1.PublicKey(data.tokenId);
85
+ if (!sender.publicKey) {
86
+ throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
87
+ }
88
+ const ixs = await this.getCreateATAInstructions([constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, partnerPublicKey], mintPublicKey, sender, true);
89
+ const { ixs: createIxs, metadata, metadataPubKey } = await this.prepareCreateInstructions(data, extParams);
90
+ ixs.push(...createIxs);
91
+ if (isNative) {
92
+ const totalFee = await this.getTotalFee({
93
+ address: partnerPublicKey.toString(),
94
+ });
95
+ const totalAmount = (0, utils_js_2.calculateTotalAmountToDeposit)(amount, totalFee);
96
+ ixs.push(...(await (0, solana_1.prepareWrappedAccount)(this.connection, sender.publicKey, totalAmount)));
97
+ }
72
98
  const { tx, hash, context } = await (0, solana_1.prepareTransaction)(this.connection, ixs, extParams.sender.publicKey, undefined, metadata);
73
99
  const signature = await (0, solana_1.signAndExecuteTransaction)(this.connection, extParams.sender, tx, {
74
100
  hash,
@@ -77,11 +103,81 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
77
103
  }, { sendThrottler: this.sendThrottler });
78
104
  return { ixs, txId: signature, metadataId: metadataPubKey.toBase58() };
79
105
  }
106
+ async prepareCreateInstructions(streamParams, extParams) {
107
+ const { ixs, metadata, metadataPubKey } = (0, contractUtils_js_1.isCreateAlignedStreamData)(streamParams)
108
+ ? await this.prepareCreateAlignedUnlockInstructions(streamParams, extParams)
109
+ : await this.prepareCreateStreamInstructions(streamParams, extParams);
110
+ return { ixs, metadata, metadataPubKey };
111
+ }
112
+ async prepareCreateAlignedUnlockInstructions(streamParams, extParams) {
113
+ const { tokenId: mint, start, period, cliff, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, partner, recipient, cliffAmount, amountPerPeriod, amount: depositedAmount, name: streamName, minPrice, maxPercentage, minPercentage, maxPrice, skipInitial, tickSize, priceOracle, oracleType, } = streamParams;
114
+ const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
115
+ if (!sender.publicKey) {
116
+ throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
117
+ }
118
+ if (!priceOracle && oracleType && oracleType !== "none") {
119
+ throw new Error("Price oracle is required for the specified oracle type");
120
+ }
121
+ const recipientPublicKey = new web3_js_1.PublicKey(recipient);
122
+ const mintPublicKey = isNative ? spl_token_1.NATIVE_MINT : new web3_js_1.PublicKey(mint);
123
+ const metadata = !metadataPubKeys ? web3_js_1.Keypair.generate() : undefined;
124
+ const metadataPubKey = metadata ? metadata.publicKey : metadataPubKeys[0];
125
+ const { tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, mintPublicKey);
126
+ const partnerPublicKey = partner ? new web3_js_1.PublicKey(partner) : constants_js_1.WITHDRAWOR_PUBLIC_KEY;
127
+ const streamflowProgramPublicKey = new web3_js_1.PublicKey(this.programId);
128
+ const escrowPDA = (0, derive_accounts_js_1.deriveEscrowPDA)(streamflowProgramPublicKey, metadataPubKey);
129
+ const oracle = priceOracle ?? (0, derive_accounts_js_1.deriveTestOraclePDA)(this.alignedProxyProgram.programId, mintPublicKey, sender.publicKey);
130
+ const ixs = (0, solana_1.prepareBaseInstructions)(this.connection, {
131
+ computePrice,
132
+ computeLimit: computeLimit ?? constants_js_1.ALIGNED_COMPUTE_LIMIT,
133
+ });
134
+ ixs.push(...(await this.getCreateATAInstructions([recipientPublicKey], mintPublicKey, sender, true, tokenProgramId)));
135
+ const encodedUIntArray = new TextEncoder().encode(streamName);
136
+ const streamNameArray = Array.from(encodedUIntArray);
137
+ const createIx = await this.alignedProxyProgram.methods
138
+ .create({
139
+ startTime: new bn_js_1.default(start),
140
+ netAmountDeposited: depositedAmount,
141
+ period: new bn_js_1.default(period),
142
+ amountPerPeriod: amountPerPeriod,
143
+ cliff: new bn_js_1.default(cliff),
144
+ cliffAmount: cliffAmount,
145
+ transferableBySender,
146
+ transferableByRecipient,
147
+ cancelableByRecipient,
148
+ cancelableBySender,
149
+ canTopup,
150
+ oracleType: (!!oracleType ? { [oracleType]: {} } : { none: {} }),
151
+ streamName: streamNameArray,
152
+ minPrice: (0, common_1.getBN)(minPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
153
+ maxPrice: (0, common_1.getBN)(maxPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
154
+ minPercentage: (0, common_1.getBN)(minPercentage, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
155
+ maxPercentage: (0, common_1.getBN)(maxPercentage, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
156
+ tickSize: new bn_js_1.default(tickSize || 1),
157
+ skipInitial: skipInitial ?? false,
158
+ })
159
+ .accountsPartial({
160
+ sender: sender.publicKey,
161
+ streamMetadata: metadataPubKey,
162
+ escrowTokens: escrowPDA,
163
+ mint: mintPublicKey,
164
+ partner: partnerPublicKey,
165
+ recipient: recipientPublicKey,
166
+ withdrawor: constants_js_1.WITHDRAWOR_PUBLIC_KEY,
167
+ feeOracle: constants_js_1.FEE_ORACLE_PUBLIC_KEY,
168
+ priceOracle: oracle,
169
+ tokenProgram: tokenProgramId,
170
+ streamflowProgram: this.programId,
171
+ })
172
+ .instruction();
173
+ ixs.push(createIx);
174
+ return { ixs, metadata, metadataPubKey };
175
+ }
80
176
  /**
81
177
  * Creates a new stream/vesting contract.
82
178
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
83
179
  */
84
- async prepareCreateInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal = false, withdrawalFrequency = 0, partner, }, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
180
+ async prepareCreateStreamInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal = false, withdrawalFrequency = 0, partner, }, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
85
181
  if (!sender.publicKey) {
86
182
  throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
87
183
  }
@@ -99,13 +195,6 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
99
195
  const streamflowTreasuryTokens = await (0, solana_1.ata)(mintPublicKey, constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
100
196
  const partnerPublicKey = partner ? new web3_js_1.PublicKey(partner) : constants_js_1.WITHDRAWOR_PUBLIC_KEY;
101
197
  const partnerTokens = await (0, solana_1.ata)(mintPublicKey, partnerPublicKey, tokenProgramId);
102
- if (isNative) {
103
- const totalFee = await this.getTotalFee({
104
- address: partnerPublicKey.toString(),
105
- });
106
- const totalAmount = (0, utils_js_2.calculateTotalAmountToDeposit)(depositedAmount, totalFee);
107
- ixs.push(...(await (0, solana_1.prepareWrappedAccount)(this.connection, sender.publicKey, totalAmount)));
108
- }
109
198
  ixs.push((0, instructions_js_1.createStreamInstruction)({
110
199
  start: new bn_js_1.default(start),
111
200
  depositedAmount,
@@ -235,26 +324,34 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
235
324
  * Creates multiple stream/vesting contracts.
236
325
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
237
326
  */
238
- async createMultiple(data, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
239
- const { recipients } = data;
240
- if (!sender.publicKey) {
241
- throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
242
- }
327
+ async createMultiple(data, extParams) {
328
+ const { recipients, ...streamParams } = data;
329
+ const { sender, metadataPubKeys: metadataPubKeysExt, isNative, computePrice, computeLimit } = extParams;
243
330
  const metadatas = [];
244
331
  const metadataToRecipient = {};
245
332
  const errors = [];
246
333
  const signatures = [];
247
334
  const batch = [];
248
335
  const instructionsBatch = [];
249
- metadataPubKeys = metadataPubKeys || [];
336
+ const metadataPubKeys = metadataPubKeysExt || [];
337
+ const partnerPublicKey = data.partner ? new web3_js_1.PublicKey(data.partner) : constants_js_1.WITHDRAWOR_PUBLIC_KEY;
338
+ const mintPublicKey = new web3_js_1.PublicKey(data.tokenId);
339
+ if (recipients.length === 0) {
340
+ throw new Error("Recipients array is empty!");
341
+ }
342
+ if (!sender.publicKey) {
343
+ throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
344
+ }
250
345
  for (let i = 0; i < recipients.length; i++) {
251
346
  const recipientData = recipients[i];
252
- const { ixs, metadata, metadataPubKey } = await this.prepareStreamInstructions(recipientData, data, {
347
+ const createStreamData = { ...streamParams, ...recipientData };
348
+ const createStreamExtParams = {
253
349
  sender,
254
350
  metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : undefined,
255
351
  computePrice,
256
352
  computeLimit,
257
- });
353
+ };
354
+ const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(createStreamData, createStreamExtParams);
258
355
  metadataToRecipient[metadataPubKey.toBase58()] = recipientData;
259
356
  metadatas.push(metadataPubKey.toBase58());
260
357
  instructionsBatch.push({
@@ -276,13 +373,17 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
276
373
  }
277
374
  batch.push({ tx, recipient });
278
375
  }
376
+ const prepareInstructions = await this.getCreateATAInstructions([constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, partnerPublicKey], mintPublicKey, sender, true);
279
377
  if (isNative) {
280
378
  const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new bn_js_1.default(0));
281
379
  const nativeInstructions = await (0, solana_1.prepareWrappedAccount)(this.connection, sender.publicKey, totalDepositedAmount);
380
+ prepareInstructions.push(...nativeInstructions);
381
+ }
382
+ if (prepareInstructions.length > 0) {
282
383
  const messageV0 = new web3_js_1.TransactionMessage({
283
384
  payerKey: sender.publicKey,
284
385
  recentBlockhash: hash.blockhash,
285
- instructions: nativeInstructions,
386
+ instructions: prepareInstructions,
286
387
  }).compileToV0Message();
287
388
  const tx = new web3_js_1.VersionedTransaction(messageV0);
288
389
  batch.push({
@@ -291,7 +392,7 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
291
392
  });
292
393
  }
293
394
  const signedBatch = await (0, utils_js_1.signAllTransactionWithRecipients)(sender, batch);
294
- if (isNative) {
395
+ if (prepareInstructions.length > 0) {
295
396
  const prepareTx = signedBatch.pop();
296
397
  await (0, utils_js_1.sendAndConfirmStreamRawTransaction)(this.connection, prepareTx, { hash, context }, { sendThrottler: this.sendThrottler });
297
398
  }
@@ -355,21 +456,22 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
355
456
  throw new Error("Couldn't get account info");
356
457
  }
357
458
  const data = (0, utils_js_1.decodeStream)(escrow.data);
358
- const { tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, data.mint);
359
- const streamflowTreasuryTokens = await (0, solana_1.ata)(data.mint, constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
360
- const partnerTokens = await (0, solana_1.ata)(data.mint, data.partner, tokenProgramId);
361
- await this.checkAssociatedTokenAccounts(data, { invoker, checkTokenAccounts }, ixs, tokenProgramId);
362
- ixs.push((0, instructions_js_1.withdrawStreamInstruction)(amount, this.programId, {
459
+ const { sender, recipient, mint, streamflowTreasury, partner, recipientTokens, escrowTokens } = data;
460
+ const { tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, mint);
461
+ const streamflowTreasuryTokens = await (0, solana_1.ata)(mint, constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
462
+ const partnerTokens = await (0, solana_1.ata)(mint, partner, tokenProgramId);
463
+ const ataIx = await this.getCreateATAInstructions([sender, recipient, streamflowTreasury, partner], mint, invoker, checkTokenAccounts, tokenProgramId);
464
+ ixs.push(...ataIx, (0, instructions_js_1.withdrawStreamInstruction)(amount, this.programId, {
465
+ partner,
466
+ partnerTokens,
467
+ mint,
468
+ streamflowTreasuryTokens,
469
+ recipientTokens,
470
+ escrowTokens,
363
471
  authority: invoker.publicKey,
364
472
  recipient: invoker.publicKey,
365
- recipientTokens: data.recipientTokens,
366
473
  metadata: streamPublicKey,
367
- escrowTokens: data.escrowTokens,
368
474
  streamflowTreasury: constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY,
369
- streamflowTreasuryTokens,
370
- partner: data.partner,
371
- partnerTokens,
372
- mint: data.mint,
373
475
  tokenProgram: tokenProgramId,
374
476
  }));
375
477
  return ixs;
@@ -377,8 +479,8 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
377
479
  /**
378
480
  * Attempts canceling the specified stream.
379
481
  */
380
- async cancel({ id }, extParams) {
381
- const ixs = await this.prepareCancelInstructions({ id }, extParams);
482
+ async cancel(cancelData, extParams) {
483
+ const ixs = await this.prepareCancelInstructions(cancelData, extParams);
382
484
  const { tx, hash, context } = await (0, solana_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey);
383
485
  const signature = await (0, solana_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, {
384
486
  hash,
@@ -387,10 +489,57 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
387
489
  }, { sendThrottler: this.sendThrottler });
388
490
  return { ixs, txId: signature };
389
491
  }
492
+ async prepareCancelInstructions(cancelData, extParams) {
493
+ const streamPublicKey = new web3_js_1.PublicKey(cancelData.id);
494
+ const account = await this.connection.getAccountInfo(streamPublicKey);
495
+ if (!account) {
496
+ throw new Error("Impossible to cancel a stream contract that does not exist");
497
+ }
498
+ const { sender: senderPublicKey } = (0, utils_js_1.decodeStream)(account.data);
499
+ const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
500
+ const ixs = isAlignedUnlock
501
+ ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams)
502
+ : await this.prepareCancelStreamInstructions(cancelData, extParams);
503
+ return ixs;
504
+ }
505
+ async prepareCancelAlignedUnlockInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
506
+ if (!invoker.publicKey) {
507
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
508
+ }
509
+ const streamPublicKey = new web3_js_1.PublicKey(id);
510
+ const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
511
+ if (!escrowAcc?.data) {
512
+ throw new Error("Couldn't get account info");
513
+ }
514
+ const streamData = (0, utils_js_1.decodeStream)(escrowAcc.data);
515
+ const { sender, recipient, mint, streamflowTreasury, partner, escrowTokens } = streamData;
516
+ const { tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, mint);
517
+ const ixs = (0, solana_1.prepareBaseInstructions)(this.connection, {
518
+ computePrice,
519
+ computeLimit: computeLimit ?? constants_js_1.ALIGNED_COMPUTE_LIMIT,
520
+ });
521
+ const ataIx = await this.getCreateATAInstructions([sender, recipient, partner, streamflowTreasury], mint, invoker, checkTokenAccounts, tokenProgramId);
522
+ const cancelIx = await this.alignedProxyProgram.methods
523
+ .cancel()
524
+ .accountsPartial({
525
+ mint,
526
+ partner,
527
+ recipient,
528
+ escrowTokens,
529
+ sender: invoker.publicKey,
530
+ streamMetadata: streamPublicKey,
531
+ streamflowTreasury: constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY,
532
+ tokenProgram: tokenProgramId,
533
+ streamflowProgram: this.programId,
534
+ })
535
+ .instruction();
536
+ ixs.push(...ataIx, cancelIx);
537
+ return ixs;
538
+ }
390
539
  /**
391
540
  * Creates Transaction Instructions for cancel
392
541
  */
393
- async prepareCancelInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
542
+ async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
394
543
  if (!invoker.publicKey) {
395
544
  throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
396
545
  }
@@ -399,28 +548,29 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
399
548
  if (!escrowAcc?.data) {
400
549
  throw new Error("Couldn't get account info");
401
550
  }
402
- const data = (0, utils_js_1.decodeStream)(escrowAcc?.data);
403
- const { tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, data.mint);
404
- const streamflowTreasuryTokens = await (0, solana_1.ata)(data.mint, constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
405
- const partnerTokens = await (0, solana_1.ata)(data.mint, data.partner, tokenProgramId);
551
+ const data = (0, utils_js_1.decodeStream)(escrowAcc.data);
552
+ const { sender, recipient, partner, streamflowTreasury, mint, senderTokens, recipientTokens, escrowTokens } = data;
553
+ const { tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, mint);
554
+ const streamflowTreasuryTokens = await (0, solana_1.ata)(mint, constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
555
+ const partnerTokens = await (0, solana_1.ata)(mint, partner, tokenProgramId);
406
556
  const ixs = (0, solana_1.prepareBaseInstructions)(this.connection, {
407
557
  computePrice,
408
558
  computeLimit,
409
559
  });
410
- await this.checkAssociatedTokenAccounts(data, { invoker, checkTokenAccounts }, ixs, tokenProgramId);
411
- ixs.push((0, instructions_js_1.cancelStreamInstruction)(this.programId, {
560
+ const ixsAta = await this.getCreateATAInstructions([sender, recipient, partner, streamflowTreasury], mint, invoker, checkTokenAccounts, tokenProgramId);
561
+ ixs.push(...ixsAta, (0, instructions_js_1.cancelStreamInstruction)(this.programId, {
562
+ sender,
563
+ senderTokens,
564
+ recipient,
565
+ recipientTokens,
566
+ streamflowTreasuryTokens,
567
+ partner,
568
+ partnerTokens,
569
+ mint,
570
+ escrowTokens,
412
571
  authority: invoker.publicKey,
413
- sender: data.sender,
414
- senderTokens: data.senderTokens,
415
- recipient: data.recipient,
416
- recipientTokens: data.recipientTokens,
417
572
  metadata: streamPublicKey,
418
- escrowTokens: data.escrowTokens,
419
573
  streamflowTreasury: constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY,
420
- streamflowTreasuryTokens: streamflowTreasuryTokens,
421
- partner: data.partner,
422
- partnerTokens,
423
- mint: data.mint,
424
574
  tokenProgram: tokenProgramId,
425
575
  }));
426
576
  return ixs;
@@ -529,11 +679,56 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
529
679
  * Fetch stream data by its id (address).
530
680
  */
531
681
  async getOne({ id }) {
532
- const escrow = await this.connection.getAccountInfo(new web3_js_1.PublicKey(id), constants_js_1.TX_FINALITY_CONFIRMED);
682
+ const streamPublicKey = new web3_js_1.PublicKey(id);
683
+ const escrow = await this.connection.getAccountInfo(streamPublicKey, constants_js_1.TX_FINALITY_CONFIRMED);
533
684
  if (!escrow?.data) {
534
685
  throw new Error("Couldn't get account info.");
535
686
  }
536
- return new types_js_1.Contract((0, utils_js_1.decodeStream)(escrow?.data));
687
+ const stream = (0, utils_js_1.decodeStream)(escrow.data);
688
+ if (this.isAlignedUnlock(streamPublicKey, stream.sender)) {
689
+ const alignedProxy = await this.alignedProxyProgram.account.contract.fetch((0, derive_accounts_js_1.deriveContractPDA)(this.alignedProxyProgram.programId, streamPublicKey));
690
+ if (!alignedProxy) {
691
+ throw new Error("Couldn't get proxy account info.");
692
+ }
693
+ return new types_js_1.AlignedContract(stream, alignedProxy);
694
+ }
695
+ return new types_js_1.Contract(stream);
696
+ }
697
+ /**
698
+ * Fetch all aligned outgoing streams/contracts by the provided public key.
699
+ */
700
+ async getOutgoingAlignedStreams(sender) {
701
+ const streams = {};
702
+ const alignedOutgoingProgramAccounts = await this.alignedProxyProgram.account.contract.all([
703
+ {
704
+ memcmp: {
705
+ offset: constants_js_1.ORIGINAL_CONTRACT_SENDER_OFFSET,
706
+ bytes: sender,
707
+ },
708
+ },
709
+ ]);
710
+ const streamPubKeys = alignedOutgoingProgramAccounts.map((account) => account.account.stream);
711
+ const streamAccounts = await this.connection.getMultipleAccountsInfo(streamPubKeys, constants_js_1.TX_FINALITY_CONFIRMED);
712
+ streamAccounts.forEach((account, index) => {
713
+ if (account) {
714
+ const alignedData = alignedOutgoingProgramAccounts[index].account;
715
+ streams[streamPubKeys[index].toBase58()] = new types_js_1.AlignedContract((0, utils_js_1.decodeStream)(account.data), alignedData);
716
+ }
717
+ });
718
+ return streams;
719
+ }
720
+ async getIncomingAlignedStreams(streamRecord) {
721
+ const streams = {};
722
+ const alignedStreamsPubKeys = Object.keys(streamRecord);
723
+ const alignedProxyPDAs = alignedStreamsPubKeys.map((streamPubKey) => (0, derive_accounts_js_1.deriveContractPDA)(this.alignedProxyProgram.programId, new web3_js_1.PublicKey(streamPubKey)));
724
+ const alignedProxyAccounts = await this.alignedProxyProgram.account.contract.fetchMultiple(alignedProxyPDAs);
725
+ alignedProxyAccounts.forEach((account, index) => {
726
+ if (account) {
727
+ const alignedData = streamRecord[alignedStreamsPubKeys[index]];
728
+ streams[alignedStreamsPubKeys[index]] = new types_js_1.AlignedContract(alignedData, account);
729
+ }
730
+ });
731
+ return streams;
537
732
  }
538
733
  /**
539
734
  * Fetch streams/contracts by providing direction.
@@ -541,24 +736,39 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
541
736
  */
542
737
  async get({ address, type = types_js_2.StreamType.All, direction = types_js_2.StreamDirection.All, }) {
543
738
  const publicKey = new web3_js_1.PublicKey(address);
544
- let accounts = [];
545
- //todo: we need to be smart with our layout so we minimize rpc calls to the chain
546
- if (direction === "all") {
547
- const outgoingAccounts = await (0, solana_1.getProgramAccounts)(this.connection, publicKey, constants_js_1.STREAM_STRUCT_OFFSET_SENDER, this.programId);
548
- const incomingAccounts = await (0, solana_1.getProgramAccounts)(this.connection, publicKey, constants_js_1.STREAM_STRUCT_OFFSET_RECIPIENT, this.programId);
549
- accounts = [...outgoingAccounts, ...incomingAccounts];
739
+ let streams = {};
740
+ // don't do unnecessary rpc calls if we are not querying for vesting streams
741
+ const shouldFetchAligned = type === types_js_2.StreamType.All || type === types_js_2.StreamType.Vesting;
742
+ if (direction !== types_js_2.StreamDirection.Incoming) {
743
+ const outgoingStreamAccounts = await (0, solana_1.getProgramAccounts)(this.connection, publicKey, constants_js_1.STREAM_STRUCT_OFFSET_SENDER, this.programId);
744
+ outgoingStreamAccounts.forEach((account) => {
745
+ streams[account.pubkey.toBase58()] = new types_js_1.Contract((0, utils_js_1.decodeStream)(account.account.data));
746
+ });
747
+ if (shouldFetchAligned) {
748
+ const alignedStreams = await this.getOutgoingAlignedStreams(address);
749
+ streams = { ...streams, ...alignedStreams };
750
+ }
550
751
  }
551
- else {
552
- const offset = direction === "outgoing" ? constants_js_1.STREAM_STRUCT_OFFSET_SENDER : constants_js_1.STREAM_STRUCT_OFFSET_RECIPIENT;
553
- accounts = await (0, solana_1.getProgramAccounts)(this.connection, publicKey, offset, this.programId);
752
+ if (direction !== types_js_2.StreamDirection.Outgoing) {
753
+ const allIncomingAccounts = await (0, solana_1.getProgramAccounts)(this.connection, publicKey, constants_js_1.STREAM_STRUCT_OFFSET_RECIPIENT, this.programId);
754
+ const allIncomingStreams = allIncomingAccounts.map((account) => (0, utils_js_1.decodeStream)(account.account.data));
755
+ const alignedDecoded = {};
756
+ // filter out aligned unlocks and store them in a separate object
757
+ allIncomingAccounts.forEach((account, index) => {
758
+ if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender)) {
759
+ alignedDecoded[account.pubkey.toBase58()] = allIncomingStreams[index];
760
+ }
761
+ else {
762
+ streams[account.pubkey.toBase58()] = new types_js_1.Contract(allIncomingStreams[index]);
763
+ }
764
+ });
765
+ if (shouldFetchAligned) {
766
+ const incomingAlignedStreams = await this.getIncomingAlignedStreams(alignedDecoded);
767
+ streams = { ...streams, ...incomingAlignedStreams };
768
+ }
554
769
  }
555
- let streams = {};
556
- accounts.forEach((account) => {
557
- const decoded = new types_js_1.Contract((0, utils_js_1.decodeStream)(account.account.data));
558
- streams = { ...streams, [account.pubkey.toBase58()]: decoded };
559
- });
560
770
  const sortedStreams = Object.entries(streams).sort(([, stream1], [, stream2]) => stream2.start - stream1.start);
561
- if (type === "all")
771
+ if (type === types_js_2.StreamType.All)
562
772
  return sortedStreams;
563
773
  return sortedStreams.filter((stream) => stream[1].type === type);
564
774
  }
@@ -641,68 +851,6 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
641
851
  const logs = "logs" in err && Array.isArray(err.logs) ? err.logs : undefined;
642
852
  return (0, utils_js_1.extractSolanaErrorCode)(err.toString() ?? "Unknown error!", logs);
643
853
  }
644
- /**
645
- * Forms instructions from params, creates a raw transaction and fetch recent blockhash.
646
- */
647
- async prepareStreamInstructions(recipient, streamParams, extParams) {
648
- const { tokenId: mint, start, period, cliff, canTopup, canUpdateRate, canPause, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal = false, withdrawalFrequency = 0, partner, } = streamParams;
649
- const { sender, metadataPubKeys, computeLimit, computePrice } = extParams;
650
- if (!sender.publicKey) {
651
- throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
652
- }
653
- const ixs = (0, solana_1.prepareBaseInstructions)(this.connection, {
654
- computePrice,
655
- computeLimit,
656
- });
657
- const recipientPublicKey = new web3_js_1.PublicKey(recipient.recipient);
658
- const mintPublicKey = new web3_js_1.PublicKey(mint);
659
- const { metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys);
660
- const [escrowTokens] = web3_js_1.PublicKey.findProgramAddressSync([buffer_1.Buffer.from("strm"), metadataPubKey.toBuffer()], this.programId);
661
- const { tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, mintPublicKey);
662
- const senderTokens = await (0, solana_1.ata)(mintPublicKey, sender.publicKey, tokenProgramId);
663
- const recipientTokens = await (0, solana_1.ata)(mintPublicKey, recipientPublicKey, tokenProgramId);
664
- const streamflowTreasuryTokens = await (0, solana_1.ata)(mintPublicKey, constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
665
- const partnerPublicKey = partner ? new web3_js_1.PublicKey(partner) : constants_js_1.WITHDRAWOR_PUBLIC_KEY;
666
- const partnerTokens = await (0, solana_1.ata)(mintPublicKey, partnerPublicKey, tokenProgramId);
667
- ixs.push((0, instructions_js_1.createStreamInstruction)({
668
- start: new bn_js_1.default(start),
669
- depositedAmount: recipient.amount,
670
- period: new bn_js_1.default(period),
671
- amountPerPeriod: recipient.amountPerPeriod,
672
- cliff: new bn_js_1.default(cliff),
673
- cliffAmount: new bn_js_1.default(recipient.cliffAmount),
674
- cancelableBySender,
675
- cancelableByRecipient,
676
- automaticWithdrawal,
677
- transferableBySender,
678
- transferableByRecipient,
679
- canTopup,
680
- canUpdateRate: !!canUpdateRate,
681
- canPause: !!canPause,
682
- name: recipient.name,
683
- withdrawFrequency: new bn_js_1.default(automaticWithdrawal ? withdrawalFrequency : period),
684
- }, this.programId, {
685
- sender: sender.publicKey,
686
- senderTokens,
687
- recipient: new web3_js_1.PublicKey(recipient.recipient),
688
- metadata: metadataPubKey,
689
- escrowTokens,
690
- recipientTokens,
691
- streamflowTreasury: constants_js_1.STREAMFLOW_TREASURY_PUBLIC_KEY,
692
- streamflowTreasuryTokens: streamflowTreasuryTokens,
693
- partner: partnerPublicKey,
694
- partnerTokens: partnerTokens,
695
- mint: new web3_js_1.PublicKey(mint),
696
- feeOracle: constants_js_1.FEE_ORACLE_PUBLIC_KEY,
697
- rent: web3_js_1.SYSVAR_RENT_PUBKEY,
698
- timelockProgram: this.programId,
699
- tokenProgram: tokenProgramId,
700
- associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
701
- withdrawor: constants_js_1.WITHDRAWOR_PUBLIC_KEY,
702
- systemProgram: web3_js_1.SystemProgram.programId,
703
- }));
704
- return { ixs, metadata, metadataPubKey };
705
- }
706
854
  /**
707
855
  * Utility function to generate metadata for a Contract or return existing Pubkey
708
856
  */
@@ -719,19 +867,22 @@ class SolanaStreamClient extends BaseStreamClient_js_1.BaseStreamClient {
719
867
  return { metadata, metadataPubKey };
720
868
  }
721
869
  /**
722
- * Utility function that checks whether associated token accounts still exist and adds instructions to add them if not
870
+ * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
723
871
  */
724
- async checkAssociatedTokenAccounts(data, { invoker, checkTokenAccounts }, ixs, programId) {
872
+ isAlignedUnlock(streamPublicKey, senderPublicKey) {
873
+ const pda = (0, derive_accounts_js_1.deriveContractPDA)(this.alignedProxyProgram.programId, streamPublicKey);
874
+ return senderPublicKey.equals(pda);
875
+ }
876
+ /**
877
+ * Returns insrtuctions for creating associated token accounts for the provided owners
878
+ */
879
+ async getCreateATAInstructions(owners, mint, invoker, checkTokenAccounts, programId) {
725
880
  if (!checkTokenAccounts) {
726
- return;
727
- }
728
- const owners = Array.from(new Set([
729
- data.sender.toBase58(),
730
- data.recipient.toBase58(),
731
- data.partner.toBase58(),
732
- data.streamflowTreasury.toBase58(),
733
- ]), (address) => new web3_js_1.PublicKey(address));
734
- ixs.push(...(await (0, solana_1.checkOrCreateAtaBatch)(this.connection, owners, data.mint, invoker, programId)));
881
+ return [];
882
+ }
883
+ // filter out duplicate PublicKeys, otherwise transaction will fail
884
+ const uniqueOwners = Array.from(new Set(owners.map((owner) => owner.toBase58()))).map((pkString) => new web3_js_1.PublicKey(pkString));
885
+ return (0, solana_1.checkOrCreateAtaBatch)(this.connection, uniqueOwners, mint, invoker, programId);
735
886
  }
736
887
  }
737
888
  exports.SolanaStreamClient = SolanaStreamClient;
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SOLANA_ERROR_MAP = exports.SOLANA_ERROR_MATCH_REGEX = exports.PARTNERS_SCHEMA = exports.PARTNER_SCHEMA = exports.AIRDROP_AMOUNT = exports.DEFAULT_STREAMFLOW_FEE = exports.FEES_METADATA_SEED = exports.AIRDROP_TEST_TOKEN = exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PARTNER_ORACLE_PROGRAM_ID = exports.PROGRAM_ID = exports.CREATE_PARAMS_PADDING = exports.STREAM_STRUCT_OFFSETS = exports.STREAM_STRUCT_OFFSET_MINT = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.TX_FINALITY_CONFIRMED = void 0;
3
+ exports.SOLANA_ERROR_MAP = exports.SOLANA_ERROR_MATCH_REGEX = exports.PARTNERS_SCHEMA = exports.PARTNER_SCHEMA = exports.AIRDROP_AMOUNT = exports.DEFAULT_STREAMFLOW_FEE = exports.FEES_METADATA_SEED = exports.AIRDROP_TEST_TOKEN = exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PARTNER_ORACLE_PROGRAM_ID = exports.TEST_ORACLE_SEED = exports.ESCROW_SEED = exports.CONTRACT_SEED = exports.TEST_ORACLE_DISCRIMINATOR = exports.CONTRACT_DISCRIMINATOR = exports.ALIGNED_COMPUTE_LIMIT = exports.ALIGNED_UNLOCKS_PROGRAM_ID = exports.PROGRAM_ID = exports.CREATE_PARAMS_PADDING = exports.STREAM_STRUCT_OFFSETS = exports.ALIGNED_PRECISION_FACTOR_POW = exports.STREAM_STRUCT_OFFSET_MINT = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.ORIGINAL_CONTRACT_SENDER_OFFSET = exports.TX_FINALITY_CONFIRMED = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  const buffer_1 = require("buffer");
6
6
  const types_js_1 = require("../common/types.js");
7
7
  exports.TX_FINALITY_CONFIRMED = "confirmed";
8
+ exports.ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
8
9
  exports.STREAM_STRUCT_OFFSET_SENDER = 49;
9
10
  exports.STREAM_STRUCT_OFFSET_RECIPIENT = 113;
10
11
  exports.STREAM_STRUCT_OFFSET_MINT = 177;
12
+ exports.ALIGNED_PRECISION_FACTOR_POW = 9;
11
13
  exports.STREAM_STRUCT_OFFSETS = {
12
14
  mint: exports.STREAM_STRUCT_OFFSET_MINT,
13
15
  recipient: exports.STREAM_STRUCT_OFFSET_RECIPIENT,
@@ -21,6 +23,19 @@ exports.PROGRAM_ID = {
21
23
  [types_js_1.ICluster.Testnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
22
24
  [types_js_1.ICluster.Local]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
23
25
  };
26
+ exports.ALIGNED_UNLOCKS_PROGRAM_ID = {
27
+ [types_js_1.ICluster.Devnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
28
+ [types_js_1.ICluster.Mainnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
29
+ [types_js_1.ICluster.Testnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
30
+ [types_js_1.ICluster.Local]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
31
+ };
32
+ // Aligned Unlocks Program transactions require a higher comput limit
33
+ exports.ALIGNED_COMPUTE_LIMIT = 300000;
34
+ exports.CONTRACT_DISCRIMINATOR = [172, 138, 115, 242, 121, 67, 183, 26];
35
+ exports.TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
36
+ exports.CONTRACT_SEED = buffer_1.Buffer.from("contract", "utf-8");
37
+ exports.ESCROW_SEED = buffer_1.Buffer.from("strm", "utf-8");
38
+ exports.TEST_ORACLE_SEED = buffer_1.Buffer.from("test-oracle", "utf-8");
24
39
  exports.PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
25
40
  exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
26
41
  exports.WITHDRAWOR_PUBLIC_KEY = new web3_js_1.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
@@ -62,4 +77,17 @@ exports.SOLANA_ERROR_MAP = {
62
77
  0x85: types_js_1.SolanaContractErrorCode.AlreadyPaused,
63
78
  0x86: types_js_1.SolanaContractErrorCode.NotPaused,
64
79
  0x87: types_js_1.SolanaContractErrorCode.MetadataNotRentExempt,
80
+ 0x1770: types_js_1.SolanaAlignedProxyErrorCode.Unauthorized,
81
+ 0x1771: types_js_1.SolanaAlignedProxyErrorCode.ArithmeticError,
82
+ 0x1772: types_js_1.SolanaAlignedProxyErrorCode.UnsupportedTokenExtensions,
83
+ 0x1773: types_js_1.SolanaAlignedProxyErrorCode.PeriodTooShort,
84
+ 0x1774: types_js_1.SolanaAlignedProxyErrorCode.InvalidTickSize,
85
+ 0x1775: types_js_1.SolanaAlignedProxyErrorCode.InvalidPercentageBoundaries,
86
+ 0x1776: types_js_1.SolanaAlignedProxyErrorCode.InvalidPriceBoundaries,
87
+ 0x1777: types_js_1.SolanaAlignedProxyErrorCode.UnsupportedOracle,
88
+ 0x1778: types_js_1.SolanaAlignedProxyErrorCode.InvalidOracleAccount,
89
+ 0x1779: types_js_1.SolanaAlignedProxyErrorCode.InvalidOraclePrice,
90
+ 0x177a: types_js_1.SolanaAlignedProxyErrorCode.InvalidStreamMetadata,
91
+ 0x177b: types_js_1.SolanaAlignedProxyErrorCode.AmountAlreadyUpdated,
92
+ 0x177c: types_js_1.SolanaAlignedProxyErrorCode.AllFundsUnlocked,
65
93
  };