@streamflow/stream 3.0.16 → 3.0.18

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 (52) hide show
  1. package/dist/__tests__/aptos/streamClient.spec.d.ts +1 -0
  2. package/dist/__tests__/aptos/streamClient.spec.js +160 -0
  3. package/dist/aptos/StreamClient.d.ts +49 -0
  4. package/dist/aptos/StreamClient.js +362 -0
  5. package/dist/aptos/constants.d.ts +2 -0
  6. package/dist/aptos/constants.js +12 -0
  7. package/dist/aptos/index.d.ts +2 -0
  8. package/dist/aptos/index.js +24 -0
  9. package/dist/aptos/types.d.ts +145 -0
  10. package/dist/aptos/types.js +65 -0
  11. package/dist/common/BaseStreamClient.d.ts +11 -0
  12. package/dist/common/BaseStreamClient.js +9 -0
  13. package/dist/common/GenericStreamClient.d.ts +60 -0
  14. package/dist/common/GenericStreamClient.js +137 -0
  15. package/dist/common/types.d.ts +71 -0
  16. package/dist/common/types.js +28 -0
  17. package/dist/{utils.d.ts → common/utils.d.ts} +0 -4
  18. package/dist/common/utils.js +31 -0
  19. package/dist/index.d.ts +5 -6
  20. package/dist/index.js +19 -10
  21. package/dist/solana/StreamClient.d.ts +71 -0
  22. package/dist/{StreamClient.js → solana/StreamClient.js} +304 -397
  23. package/dist/{constants.d.ts → solana/constants.d.ts} +1 -1
  24. package/dist/{constants.js → solana/constants.js} +5 -5
  25. package/dist/solana/index.d.ts +7 -0
  26. package/dist/solana/index.js +43 -0
  27. package/dist/solana/instructionTypes.d.ts +86 -0
  28. package/dist/solana/instructionTypes.js +2 -0
  29. package/dist/{instructions.d.ts → solana/instructions.d.ts} +8 -2
  30. package/dist/{instructions.js → solana/instructions.js} +55 -38
  31. package/dist/solana/layout.d.ts +27 -0
  32. package/dist/{layout.js → solana/layout.js} +65 -3
  33. package/dist/{idl/timelock.d.ts → solana/timelockIDL.d.ts} +0 -0
  34. package/dist/{idl/timelock.js → solana/timelockIDL.js} +0 -0
  35. package/dist/{types.d.ts → solana/types.d.ts} +37 -34
  36. package/dist/{types.js → solana/types.js} +3 -20
  37. package/dist/solana/utils.d.ts +42 -0
  38. package/dist/solana/utils.js +271 -0
  39. package/package.json +1 -1
  40. package/dist/Stream.d.ts +0 -87
  41. package/dist/Stream.js +0 -503
  42. package/dist/StreamClient.d.ts +0 -146
  43. package/dist/__tests__/test_dependencies/airdrop/airdrop-request.d.ts +0 -3
  44. package/dist/__tests__/test_dependencies/airdrop/airdrop-request.js +0 -67
  45. package/dist/__tests__/test_dependencies/airdrop/airdrop.d.ts +0 -6
  46. package/dist/__tests__/test_dependencies/airdrop/airdrop.js +0 -215
  47. package/dist/__tests__/test_dependencies/constants/index.d.ts +0 -122
  48. package/dist/__tests__/test_dependencies/constants/index.js +0 -158
  49. package/dist/__tests__/test_dependencies/idl/airdrop.d.ts +0 -27
  50. package/dist/__tests__/test_dependencies/idl/airdrop.js +0 -171
  51. package/dist/layout.d.ts +0 -22
  52. package/dist/utils.js +0 -126
@@ -0,0 +1,71 @@
1
+ import { Connection, Commitment, ConnectionConfig } from "@solana/web3.js";
2
+ import { Stream as StreamData, GetAllParams, CreateResponse, CreateMultiResponse, TxResponse, ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt } from "./types";
3
+ import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateStreamData, IGetOneData, ITopUpData, ITransferData, IUpdateData, IWithdrawData } from "../common/types";
4
+ import { BaseStreamClient } from "../common/BaseStreamClient";
5
+ export default class SolanaStreamClient extends BaseStreamClient {
6
+ private connection;
7
+ private programId;
8
+ private commitment;
9
+ /**
10
+ * Create Stream instance
11
+ */
12
+ constructor(clusterUrl: string, cluster?: ICluster, commitment?: Commitment | ConnectionConfig, programId?: string);
13
+ getConnection(): Connection;
14
+ getProgramId(): string;
15
+ /**
16
+ * Creates a new stream/vesting contract.
17
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
18
+ */
19
+ create({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, }: ICreateStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<CreateResponse>;
20
+ /**
21
+ * Creates a new stream/vesting contract using unchecked instruction.
22
+ *
23
+ * Unchecked instruction differes from the regular in:
24
+ * - does not check for initialized associated token account (wallets with no control over their ATA should not be used
25
+ * as sender/recipient/partner or there are risks of funds being locked in the contract)
26
+ * - initialized contract PDA off chain
27
+ *
28
+ * If you are not sure if you should use create or create_unchecked, go for create to be safer.
29
+ */
30
+ createUnchecked({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, }: ICreateStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<CreateResponse>;
31
+ /**
32
+ * Creates multiple stream/vesting contracts.
33
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
34
+ */
35
+ createMultiple(data: ICreateMultipleStreamData, { sender, partner, isNative }: ICreateStreamSolanaExt): Promise<CreateMultiResponse>;
36
+ /**
37
+ * Attempts withdrawing from the specified stream.
38
+ */
39
+ withdraw({ id, amount }: IWithdrawData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
40
+ /**
41
+ * Attempts canceling the specified stream.
42
+ */
43
+ cancel({ id }: ICancelData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
44
+ /**
45
+ * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
46
+ * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
47
+ */
48
+ transfer({ id, newRecipient: newRecipientString }: ITransferData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
49
+ /**
50
+ * Tops up stream account with specified amount.
51
+ */
52
+ topup({ id, amount }: ITopUpData, { invoker, isNative }: ITopUpStreamSolanaExt): Promise<TxResponse>;
53
+ /**
54
+ * Fetch stream data by its id (address).
55
+ */
56
+ getOne({ id }: IGetOneData): Promise<StreamData>;
57
+ /**
58
+ * Fetch streams/contracts by providing direction.
59
+ * Streams are sorted by start time in ascending order.
60
+ */
61
+ get({ wallet, type, direction, }: GetAllParams): Promise<[string, StreamData][]>;
62
+ private sign;
63
+ /**
64
+ * Attempts updating the stream auto withdrawal params and amount per period
65
+ */
66
+ update(data: IUpdateData, { invoker }: IInteractStreamSolanaExt): Promise<TxResponse>;
67
+ /**
68
+ * Forms instructions from params, creates a raw transaction and fetch recent blockhash.
69
+ */
70
+ private prepareStreamTransaction;
71
+ }