@streamflow/stream 3.0.18 → 3.0.19

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/Stream.d.ts +87 -0
  2. package/dist/Stream.js +503 -0
  3. package/dist/StreamClient.d.ts +146 -0
  4. package/dist/{solana/StreamClient.js → StreamClient.js} +397 -301
  5. package/dist/__tests__/test_dependencies/airdrop/airdrop-request.d.ts +3 -0
  6. package/dist/__tests__/test_dependencies/airdrop/airdrop-request.js +67 -0
  7. package/dist/__tests__/test_dependencies/airdrop/airdrop.d.ts +6 -0
  8. package/dist/__tests__/test_dependencies/airdrop/airdrop.js +215 -0
  9. package/dist/__tests__/test_dependencies/constants/index.d.ts +122 -0
  10. package/dist/__tests__/test_dependencies/constants/index.js +158 -0
  11. package/dist/__tests__/test_dependencies/idl/airdrop.d.ts +27 -0
  12. package/dist/__tests__/test_dependencies/idl/airdrop.js +171 -0
  13. package/dist/{solana/constants.d.ts → constants.d.ts} +1 -1
  14. package/dist/{solana/constants.js → constants.js} +5 -5
  15. package/dist/{solana/timelockIDL.d.ts → idl/timelock.d.ts} +0 -0
  16. package/dist/{solana/timelockIDL.js → idl/timelock.js} +0 -0
  17. package/dist/index.d.ts +6 -5
  18. package/dist/index.js +10 -19
  19. package/dist/{solana/instructions.d.ts → instructions.d.ts} +2 -8
  20. package/dist/{solana/instructions.js → instructions.js} +38 -55
  21. package/dist/layout.d.ts +22 -0
  22. package/dist/{solana/layout.js → layout.js} +3 -65
  23. package/dist/{solana/types.d.ts → types.d.ts} +34 -37
  24. package/dist/{solana/types.js → types.js} +20 -3
  25. package/dist/{common/utils.d.ts → utils.d.ts} +4 -0
  26. package/dist/utils.js +126 -0
  27. package/package.json +1 -1
  28. package/dist/__tests__/aptos/streamClient.spec.d.ts +0 -1
  29. package/dist/__tests__/aptos/streamClient.spec.js +0 -160
  30. package/dist/aptos/StreamClient.d.ts +0 -49
  31. package/dist/aptos/StreamClient.js +0 -362
  32. package/dist/aptos/constants.d.ts +0 -2
  33. package/dist/aptos/constants.js +0 -12
  34. package/dist/aptos/index.d.ts +0 -2
  35. package/dist/aptos/index.js +0 -24
  36. package/dist/aptos/types.d.ts +0 -145
  37. package/dist/aptos/types.js +0 -65
  38. package/dist/common/BaseStreamClient.d.ts +0 -11
  39. package/dist/common/BaseStreamClient.js +0 -9
  40. package/dist/common/GenericStreamClient.d.ts +0 -60
  41. package/dist/common/GenericStreamClient.js +0 -137
  42. package/dist/common/types.d.ts +0 -71
  43. package/dist/common/types.js +0 -28
  44. package/dist/common/utils.js +0 -31
  45. package/dist/solana/StreamClient.d.ts +0 -71
  46. package/dist/solana/index.d.ts +0 -7
  47. package/dist/solana/index.js +0 -43
  48. package/dist/solana/instructionTypes.d.ts +0 -86
  49. package/dist/solana/instructionTypes.js +0 -2
  50. package/dist/solana/layout.d.ts +0 -27
  51. package/dist/solana/utils.d.ts +0 -42
  52. package/dist/solana/utils.js +0 -271
@@ -1,60 +0,0 @@
1
- import { Commitment, ConnectionConfig } from "@solana/web3.js";
2
- import SolanaStreamClient from "../solana/StreamClient";
3
- import AptosStreamClient from "../aptos/StreamClient";
4
- import { BaseStreamClient } from "./BaseStreamClient";
5
- import { ICancelData, IChain, ICluster, ICreateMultipleStreamData, ICreateStreamData, IGetOneData, ITopUpData, ITransferData, IUpdateData, IWithdrawData } from "./types";
6
- import { CreateMultiResponse, CreateResponse, ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt, Stream, TxResponse } from "../solana";
7
- import { ICreateStreamAptosExt, IMultiTransactionResult, ITransactionAptosExt, ITransactionResult } from "../aptos";
8
- export interface SolanaStreamClientOptions {
9
- chain: IChain.Solana;
10
- clusterUrl: string;
11
- cluster?: ICluster;
12
- programId?: string;
13
- commitment?: Commitment | ConnectionConfig;
14
- }
15
- export interface AptosStreamClientOptions {
16
- chain: IChain.Aptos;
17
- clusterUrl: string;
18
- cluster?: ICluster;
19
- programId?: string;
20
- maxGas?: string;
21
- }
22
- declare type GenericStreamClientOptions = SolanaStreamClientOptions | AptosStreamClientOptions;
23
- export default class GenericStreamClient extends BaseStreamClient {
24
- nativeStreamClient: SolanaStreamClient | AptosStreamClient;
25
- chain: IChain;
26
- constructor(options: GenericStreamClientOptions);
27
- /**
28
- * Creates a new stream/vesting contract.
29
- */
30
- create(streamData: ICreateStreamData, chainSpecificParams: ICreateStreamAptosExt | ICreateStreamSolanaExt): Promise<CreateResponse | ITransactionResult>;
31
- /**
32
- * Creates multiple stream/vesting contracts.
33
- */
34
- createMultiple(multipleStreamData: ICreateMultipleStreamData, chainSpecificParams: ICreateStreamAptosExt | ICreateStreamSolanaExt): Promise<CreateMultiResponse | IMultiTransactionResult>;
35
- /**
36
- * Attempts withdrawing from the specified stream.
37
- */
38
- withdraw(withdrawData: IWithdrawData, chainSpecificParams: ITransactionAptosExt | IInteractStreamSolanaExt): Promise<TxResponse | ITransactionResult>;
39
- /**
40
- * Attempts canceling the specified stream.
41
- */
42
- cancel(cancelData: ICancelData, chainSpecificParams: ITransactionAptosExt | IInteractStreamSolanaExt): Promise<TxResponse | ITransactionResult>;
43
- /**
44
- * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
45
- */
46
- transfer(transferData: ITransferData, chainSpecificParams: ITransactionAptosExt | IInteractStreamSolanaExt): Promise<TxResponse | ITransactionResult>;
47
- /**
48
- * Tops up stream account with specified amount.
49
- */
50
- topup(topupData: ITopUpData, chainSpecificParams: ITransactionAptosExt | ITopUpStreamSolanaExt): Promise<TxResponse | ITransactionResult>;
51
- /**
52
- * Fetch stream data by its id (address).
53
- */
54
- getOne(getOneData: IGetOneData): Promise<Stream>;
55
- /**
56
- * Attempts updating the stream auto withdrawal params and amount per period
57
- */
58
- update(updateData: IUpdateData, chainSpecificParams: ITransactionAptosExt | IInteractStreamSolanaExt): Promise<TxResponse | ITransactionResult>;
59
- }
60
- export {};
@@ -1,137 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- var StreamClient_1 = __importDefault(require("../solana/StreamClient"));
22
- var StreamClient_2 = __importDefault(require("../aptos/StreamClient"));
23
- var BaseStreamClient_1 = require("./BaseStreamClient");
24
- var types_1 = require("./types");
25
- var GenericStreamClient = /** @class */ (function (_super) {
26
- __extends(GenericStreamClient, _super);
27
- function GenericStreamClient(options) {
28
- var _this = _super.call(this) || this;
29
- _this.chain = options.chain;
30
- if (options.chain === types_1.IChain.Solana) {
31
- _this.nativeStreamClient = new StreamClient_1.default(options.clusterUrl, options.cluster, options.commitment, options.programId);
32
- }
33
- else {
34
- _this.nativeStreamClient = new StreamClient_2.default(options.clusterUrl, options.cluster, options.maxGas, options.programId);
35
- }
36
- return _this;
37
- }
38
- /**
39
- * Creates a new stream/vesting contract.
40
- */
41
- GenericStreamClient.prototype.create = function (streamData, chainSpecificParams) {
42
- if (this.nativeStreamClient instanceof StreamClient_1.default) {
43
- var params = chainSpecificParams;
44
- return this.nativeStreamClient.create(streamData, params);
45
- }
46
- else {
47
- var params = chainSpecificParams;
48
- return this.nativeStreamClient.create(streamData, params);
49
- }
50
- };
51
- /**
52
- * Creates multiple stream/vesting contracts.
53
- */
54
- GenericStreamClient.prototype.createMultiple = function (multipleStreamData, chainSpecificParams) {
55
- if (this.nativeStreamClient instanceof StreamClient_1.default) {
56
- var params = chainSpecificParams;
57
- return this.nativeStreamClient.createMultiple(multipleStreamData, params);
58
- }
59
- else {
60
- var params = chainSpecificParams;
61
- return this.nativeStreamClient.createMultiple(multipleStreamData, params);
62
- }
63
- };
64
- /**
65
- * Attempts withdrawing from the specified stream.
66
- */
67
- GenericStreamClient.prototype.withdraw = function (withdrawData, chainSpecificParams) {
68
- if (this.nativeStreamClient instanceof StreamClient_1.default) {
69
- var params = chainSpecificParams;
70
- return this.nativeStreamClient.withdraw(withdrawData, params);
71
- }
72
- else {
73
- var params = chainSpecificParams;
74
- return this.nativeStreamClient.withdraw(withdrawData, params);
75
- }
76
- };
77
- /**
78
- * Attempts canceling the specified stream.
79
- */
80
- GenericStreamClient.prototype.cancel = function (cancelData, chainSpecificParams) {
81
- if (this.nativeStreamClient instanceof StreamClient_1.default) {
82
- var params = chainSpecificParams;
83
- return this.nativeStreamClient.cancel(cancelData, params);
84
- }
85
- else {
86
- var params = chainSpecificParams;
87
- return this.nativeStreamClient.cancel(cancelData, params);
88
- }
89
- };
90
- /**
91
- * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
92
- */
93
- GenericStreamClient.prototype.transfer = function (transferData, chainSpecificParams) {
94
- if (this.nativeStreamClient instanceof StreamClient_1.default) {
95
- var params = chainSpecificParams;
96
- return this.nativeStreamClient.transfer(transferData, params);
97
- }
98
- else {
99
- var params = chainSpecificParams;
100
- return this.nativeStreamClient.transfer(transferData, params);
101
- }
102
- };
103
- /**
104
- * Tops up stream account with specified amount.
105
- */
106
- GenericStreamClient.prototype.topup = function (topupData, chainSpecificParams) {
107
- if (this.nativeStreamClient instanceof StreamClient_1.default) {
108
- var params = chainSpecificParams;
109
- return this.nativeStreamClient.topup(topupData, params);
110
- }
111
- else {
112
- var params = chainSpecificParams;
113
- return this.nativeStreamClient.topup(topupData, params);
114
- }
115
- };
116
- /**
117
- * Fetch stream data by its id (address).
118
- */
119
- GenericStreamClient.prototype.getOne = function (getOneData) {
120
- return this.nativeStreamClient.getOne(getOneData);
121
- };
122
- /**
123
- * Attempts updating the stream auto withdrawal params and amount per period
124
- */
125
- GenericStreamClient.prototype.update = function (updateData, chainSpecificParams) {
126
- if (this.nativeStreamClient instanceof StreamClient_1.default) {
127
- var params = chainSpecificParams;
128
- return this.nativeStreamClient.update(updateData, params);
129
- }
130
- else {
131
- var params = chainSpecificParams;
132
- return this.nativeStreamClient.update(updateData, params);
133
- }
134
- };
135
- return GenericStreamClient;
136
- }(BaseStreamClient_1.BaseStreamClient));
137
- exports.default = GenericStreamClient;
@@ -1,71 +0,0 @@
1
- import BN from "bn.js";
2
- export interface IRecipient {
3
- recipient: string;
4
- amount: BN;
5
- name: string;
6
- cliffAmount: BN;
7
- amountPerPeriod: BN;
8
- }
9
- export interface IStreamConfig {
10
- period: number;
11
- start: number;
12
- cliff: number;
13
- cancelableBySender: boolean;
14
- cancelableByRecipient: boolean;
15
- transferableBySender: boolean;
16
- transferableByRecipient: boolean;
17
- canTopup: boolean;
18
- automaticWithdrawal?: boolean;
19
- withdrawalFrequency?: number;
20
- tokenId: string;
21
- canPause?: boolean;
22
- canUpdateRate?: boolean;
23
- }
24
- export declare type ICreateStreamData = IStreamConfig & IRecipient;
25
- export declare type ICreateMultipleStreamData = IStreamConfig & {
26
- recipients: IRecipient[];
27
- };
28
- export interface IWithdrawData {
29
- id: string;
30
- amount: BN;
31
- }
32
- export interface IUpdateData {
33
- id: string;
34
- enableAutomaticWithdrawal?: boolean;
35
- withdrawFrequency?: BN;
36
- amountPerPeriod?: BN;
37
- }
38
- export interface ICancelData {
39
- id: string;
40
- }
41
- export interface ITransferData {
42
- id: string;
43
- newRecipient: string;
44
- }
45
- export interface ITopUpData {
46
- id: string;
47
- amount: BN;
48
- }
49
- export interface IGetOneData {
50
- id: string;
51
- }
52
- export declare enum ICluster {
53
- Mainnet = "mainnet",
54
- Devnet = "devnet",
55
- Testnet = "testnet",
56
- Local = "local"
57
- }
58
- export declare enum StreamDirection {
59
- Outgoing = "outgoing",
60
- Incoming = "incoming",
61
- All = "all"
62
- }
63
- export declare enum StreamType {
64
- Stream = "stream",
65
- Vesting = "vesting",
66
- All = "all"
67
- }
68
- export declare enum IChain {
69
- Solana = "Solana",
70
- Aptos = "Aptos"
71
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IChain = exports.StreamType = exports.StreamDirection = exports.ICluster = void 0;
4
- // Utility types
5
- var ICluster;
6
- (function (ICluster) {
7
- ICluster["Mainnet"] = "mainnet";
8
- ICluster["Devnet"] = "devnet";
9
- ICluster["Testnet"] = "testnet";
10
- ICluster["Local"] = "local";
11
- })(ICluster = exports.ICluster || (exports.ICluster = {}));
12
- var StreamDirection;
13
- (function (StreamDirection) {
14
- StreamDirection["Outgoing"] = "outgoing";
15
- StreamDirection["Incoming"] = "incoming";
16
- StreamDirection["All"] = "all";
17
- })(StreamDirection = exports.StreamDirection || (exports.StreamDirection = {}));
18
- var StreamType;
19
- (function (StreamType) {
20
- StreamType["Stream"] = "stream";
21
- StreamType["Vesting"] = "vesting";
22
- StreamType["All"] = "all";
23
- })(StreamType = exports.StreamType || (exports.StreamType = {}));
24
- var IChain;
25
- (function (IChain) {
26
- IChain["Solana"] = "Solana";
27
- IChain["Aptos"] = "Aptos";
28
- })(IChain = exports.IChain || (exports.IChain = {}));
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getNumberFromBN = exports.getBN = void 0;
7
- var bn_js_1 = __importDefault(require("bn.js"));
8
- /**
9
- * Used for conversion of token amounts to their Big Number representation.
10
- * Get Big Number representation in the smallest units from the same value in the highest units.
11
- * @param {number} value - Number of tokens you want to convert to its BN representation.
12
- * @param {number} decimals - Number of decimals the token has.
13
- */
14
- var getBN = function (value, decimals) {
15
- return value > (Math.pow(2, 53) - 1) / Math.pow(10, decimals)
16
- ? new bn_js_1.default(value).mul(new bn_js_1.default(Math.pow(10, decimals)))
17
- : new bn_js_1.default(value * Math.pow(10, decimals));
18
- };
19
- exports.getBN = getBN;
20
- /**
21
- * Used for token amounts conversion from their Big Number representation to number.
22
- * Get value in the highest units from BN representation of the same value in the smallest units.
23
- * @param {BN} value - Big Number representation of value in the smallest units.
24
- * @param {number} decimals - Number of decimals the token has.
25
- */
26
- var getNumberFromBN = function (value, decimals) {
27
- return value.gt(new bn_js_1.default(Math.pow(2, 53) - 1))
28
- ? value.div(new bn_js_1.default(Math.pow(10, decimals))).toNumber()
29
- : value.toNumber() / Math.pow(10, decimals);
30
- };
31
- exports.getNumberFromBN = getNumberFromBN;
@@ -1,71 +0,0 @@
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
- }
@@ -1,7 +0,0 @@
1
- export { default, default as SolanaStreamClient } from "./StreamClient";
2
- export * from "./utils";
3
- export * from "./types";
4
- export * from "./instructions";
5
- export * as constants from "./constants";
6
- export { default as timelockIDL } from "./timelockIDL";
7
- export { default as BN } from "bn.js";
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.BN = exports.timelockIDL = exports.constants = exports.SolanaStreamClient = exports.default = void 0;
33
- var StreamClient_1 = require("./StreamClient");
34
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(StreamClient_1).default; } });
35
- Object.defineProperty(exports, "SolanaStreamClient", { enumerable: true, get: function () { return __importDefault(StreamClient_1).default; } });
36
- __exportStar(require("./utils"), exports);
37
- __exportStar(require("./types"), exports);
38
- __exportStar(require("./instructions"), exports);
39
- exports.constants = __importStar(require("./constants"));
40
- var timelockIDL_1 = require("./timelockIDL");
41
- Object.defineProperty(exports, "timelockIDL", { enumerable: true, get: function () { return __importDefault(timelockIDL_1).default; } });
42
- var bn_js_1 = require("bn.js");
43
- Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return __importDefault(bn_js_1).default; } });
@@ -1,86 +0,0 @@
1
- export interface IStreamLayout {
2
- magic: Uint8Array;
3
- version: Uint8Array;
4
- created_at: Uint8Array;
5
- withdrawn_amount: Uint8Array;
6
- canceled_at: Uint8Array;
7
- end_time: Uint8Array;
8
- last_withdrawn_at: Uint8Array;
9
- sender: Uint8Array;
10
- sender_tokens: Uint8Array;
11
- recipient: Uint8Array;
12
- recipient_tokens: Uint8Array;
13
- mint: Uint8Array;
14
- escrow_tokens: Uint8Array;
15
- streamflow_treasury: Uint8Array;
16
- streamflow_treasury_tokens: Uint8Array;
17
- streamflow_fee_total: Uint8Array;
18
- streamflow_fee_withdrawn: Uint8Array;
19
- streamflow_fee_percent: number;
20
- partner: Uint8Array;
21
- partner_tokens: Uint8Array;
22
- partner_fee_total: Uint8Array;
23
- partner_fee_withdrawn: Uint8Array;
24
- partner_fee_percent: number;
25
- start_time: Uint8Array;
26
- net_amount_deposited: Uint8Array;
27
- period: Uint8Array;
28
- amount_per_period: Uint8Array;
29
- cliff: Uint8Array;
30
- cliff_amount: Uint8Array;
31
- cancelable_by_sender: number;
32
- cancelable_by_recipient: number;
33
- automatic_withdrawal: number;
34
- transferable_by_sender: number;
35
- transferable_by_recipient: number;
36
- can_topup: number;
37
- stream_name: Uint8Array;
38
- withdraw_frequency: Uint8Array;
39
- }
40
- export interface ICreateStreamLayout {
41
- start_time: Uint8Array;
42
- net_amount_deposited: Uint8Array;
43
- period: Uint8Array;
44
- amount_per_period: Uint8Array;
45
- cliff: Uint8Array;
46
- cliff_amount: Uint8Array;
47
- cancelable_by_sender: number;
48
- cancelable_by_recipient: number;
49
- automatic_withdrawal: number;
50
- transferable_by_sender: number;
51
- transferable_by_recipient: number;
52
- can_topup: number;
53
- stream_name: Uint8Array;
54
- withdraw_frequency: Uint8Array;
55
- }
56
- export interface ICreateUncheckedStreamLayout {
57
- start_time: Uint8Array;
58
- net_amount_deposited: Uint8Array;
59
- period: Uint8Array;
60
- amount_per_period: Uint8Array;
61
- cliff: Uint8Array;
62
- cliff_amount: Uint8Array;
63
- cancelable_by_sender: number;
64
- cancelable_by_recipient: number;
65
- automatic_withdrawal: number;
66
- transferable_by_sender: number;
67
- transferable_by_recipient: number;
68
- can_topup: number;
69
- stream_name: Uint8Array;
70
- withdraw_frequency: Uint8Array;
71
- recipient: Uint8Array;
72
- partner: Uint8Array;
73
- pausable: number;
74
- can_update_rate: number;
75
- }
76
- export interface IWithdrawStreamLayout {
77
- amount: Uint8Array;
78
- }
79
- export interface IUpdateStreamLayout {
80
- enable_automatic_withdrawal?: number;
81
- withdraw_frequency?: Uint8Array;
82
- amount_per_period?: Uint8Array;
83
- }
84
- export interface ITopupStreamLayout {
85
- amount: Uint8Array;
86
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,27 +0,0 @@
1
- /// <reference types="node" />
2
- import * as BufferLayout from "@solana/buffer-layout";
3
- import { ICreateStreamLayout, ICreateUncheckedStreamLayout, IStreamLayout, ITopupStreamLayout, IUpdateStreamLayout, IWithdrawStreamLayout } from "./instructionTypes";
4
- /**
5
- * Stream layout
6
- */
7
- export declare const streamLayout: BufferLayout.Structure<IStreamLayout>;
8
- /**
9
- * Create stream instruction layout
10
- */
11
- export declare const createStreamLayout: BufferLayout.Structure<ICreateStreamLayout>;
12
- /**
13
- * Create unchecked stream instruction layout
14
- */
15
- export declare const createUncheckedStreamLayout: BufferLayout.Structure<ICreateUncheckedStreamLayout>;
16
- /**
17
- * Withdraw stream instruction layout
18
- */
19
- export declare const withdrawStreamLayout: BufferLayout.Structure<IWithdrawStreamLayout>;
20
- /**
21
- * Encode stream instruction layout
22
- */
23
- export declare const encodeUpdateStream: (values: IUpdateStreamLayout, data: Buffer) => number;
24
- /**
25
- * Topup stream instruction layout
26
- */
27
- export declare const topupStreamLayout: BufferLayout.Structure<ITopupStreamLayout>;
@@ -1,42 +0,0 @@
1
- /// <reference types="node" />
2
- import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
3
- import { Connection, Keypair, PublicKey } from "@solana/web3.js";
4
- import { Stream, DecodedStream, Account, BatchItem, BatchItemResult } from "./types";
5
- export declare const decodeStream: (buf: Buffer) => DecodedStream;
6
- export declare const formatDecodedStream: (stream: DecodedStream) => Stream;
7
- /**
8
- * Wrapper function for Solana web3 getProgramAccounts with slightly better call interface
9
- * @param {Connection} connection - Solana web3 connection object.
10
- * @param {PublicKey} wallet - PublicKey to compare against.
11
- * @param {number} offset - Offset of bits of the PublicKey in the account binary.
12
- * @param {PublicKey} programId - Solana program ID.
13
- * @return {Promise<Account[]>} - Array of resulting accounts.
14
- */
15
- export declare function getProgramAccounts(connection: Connection, wallet: PublicKey, offset: number, programId: PublicKey): Promise<Account[]>;
16
- /**
17
- * Utility function to check if the transaction initiator is a KeyPair or a Wallet object
18
- * @param {Keypair | SignerWalletAdapter} walletOrKeypair - Wallet or Keypair in question
19
- * @return {boolean} - Returns true if parameter is a Wallet.
20
- */
21
- export declare function isSignerWallet(walletOrKeypair: Keypair | SignerWalletAdapter): boolean;
22
- /**
23
- * Sign passed BatchItems with wallet request or KeyPair
24
- * @param {Keypair | SignerWalletAdapter} sender - Wallet or Keypair of sendin account
25
- * @param {BatchItem[]} items - Multiple recipient contracts split into separate items
26
- * @return {BatchItem[]} - Returns items with signatures.
27
- */
28
- export declare function signAllTransactionWithRecipients(sender: Keypair | SignerWalletAdapter, items: BatchItem[]): Promise<BatchItem[]>;
29
- /**
30
- * Sign passed BatchItems with wallet request or KeyPair
31
- * @param {Connection} connection - Solana web3 connection object.
32
- * @param {BatchItem} batchItem - Signed transaction ready to be send.
33
- * @return {Promise<BatchItemResult>} - Returns settled transaction item
34
- */
35
- export declare function sendAndConfirmStreamRawTransaction(connection: Connection, batchItem: BatchItem): Promise<BatchItemResult>;
36
- /**
37
- * Shorthand call signature for getAssociatedTokenAddress, with allowance for address to be offCurve
38
- * @param {PublicKey} mint - SPL token Mint address.
39
- * @param {PublicKey} owner - Owner of the Associated Token Address
40
- * @return {Promise<PublicKey>} - Associated Token Address
41
- */
42
- export declare function ata(mint: PublicKey, owner: PublicKey): Promise<PublicKey>;